Stop cron job constantly rebooting ec2 instance
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I created a script to reboot system when CPU load hit 90%. But for some testing purpose I changed the value of max CPU Utilisation to 0.7%.
The script is programmed to run system reboot.
Now the server is never online - it constantly reboots.
My script:
#!/bin/bash
dstat| awk ' if (int($1)>0.7)
i=i+1;
print i, $1
if (int($1)>0.7)
j=j+1;
if (j>2)
print "system reboot";
cmd="sudo reboot";
system(cmd)
'
NB the script is programmed to run on reboot using crontab :
@reboot /bin/bash /ubuntu/home/reboot.sh
So I am unable to login using SSH. Because the system is constantly rebooting.
My server is an AWS ec2 instance
I have tried passing user data through aws console.
sudo apt-get purge dstat
cd /ubuntu/home && sudo rm reboot.sh
sudo /etc/init.d/cron stop
But it doesn't work.
So, any possible ways to get my instance back would be highly appreciated.
cron amazon-ec2 aws
add a comment |Â
up vote
0
down vote
favorite
I created a script to reboot system when CPU load hit 90%. But for some testing purpose I changed the value of max CPU Utilisation to 0.7%.
The script is programmed to run system reboot.
Now the server is never online - it constantly reboots.
My script:
#!/bin/bash
dstat| awk ' if (int($1)>0.7)
i=i+1;
print i, $1
if (int($1)>0.7)
j=j+1;
if (j>2)
print "system reboot";
cmd="sudo reboot";
system(cmd)
'
NB the script is programmed to run on reboot using crontab :
@reboot /bin/bash /ubuntu/home/reboot.sh
So I am unable to login using SSH. Because the system is constantly rebooting.
My server is an AWS ec2 instance
I have tried passing user data through aws console.
sudo apt-get purge dstat
cd /ubuntu/home && sudo rm reboot.sh
sudo /etc/init.d/cron stop
But it doesn't work.
So, any possible ways to get my instance back would be highly appreciated.
cron amazon-ec2 aws
Can you set boot parameters? (I don't use AWS)
â JanC
May 1 at 19:16
Idk how to set boot parameters. Thanks for suggesting though. :) Actually i found the solution. I detached my root volume from the instance and attached/mounted it on my other instance and then i opened up the mounted volume and remove the script and then detached it and attached it as root volume to the original instance. This worked as the script required was no longer there. So the system booted up perfectly. :)
â Anmol Rastogi
May 2 at 5:54
You can put your own answer in and accept it then. :)
â JanC
May 2 at 17:10
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I created a script to reboot system when CPU load hit 90%. But for some testing purpose I changed the value of max CPU Utilisation to 0.7%.
The script is programmed to run system reboot.
Now the server is never online - it constantly reboots.
My script:
#!/bin/bash
dstat| awk ' if (int($1)>0.7)
i=i+1;
print i, $1
if (int($1)>0.7)
j=j+1;
if (j>2)
print "system reboot";
cmd="sudo reboot";
system(cmd)
'
NB the script is programmed to run on reboot using crontab :
@reboot /bin/bash /ubuntu/home/reboot.sh
So I am unable to login using SSH. Because the system is constantly rebooting.
My server is an AWS ec2 instance
I have tried passing user data through aws console.
sudo apt-get purge dstat
cd /ubuntu/home && sudo rm reboot.sh
sudo /etc/init.d/cron stop
But it doesn't work.
So, any possible ways to get my instance back would be highly appreciated.
cron amazon-ec2 aws
I created a script to reboot system when CPU load hit 90%. But for some testing purpose I changed the value of max CPU Utilisation to 0.7%.
The script is programmed to run system reboot.
Now the server is never online - it constantly reboots.
My script:
#!/bin/bash
dstat| awk ' if (int($1)>0.7)
i=i+1;
print i, $1
if (int($1)>0.7)
j=j+1;
if (j>2)
print "system reboot";
cmd="sudo reboot";
system(cmd)
'
NB the script is programmed to run on reboot using crontab :
@reboot /bin/bash /ubuntu/home/reboot.sh
So I am unable to login using SSH. Because the system is constantly rebooting.
My server is an AWS ec2 instance
I have tried passing user data through aws console.
sudo apt-get purge dstat
cd /ubuntu/home && sudo rm reboot.sh
sudo /etc/init.d/cron stop
But it doesn't work.
So, any possible ways to get my instance back would be highly appreciated.
cron amazon-ec2 aws
edited May 1 at 19:05
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
Zanna
48k13119227
48k13119227
asked Apr 26 at 14:13
![](https://lh3.googleusercontent.com/-edz4hJFea1w/AAAAAAAAAAI/AAAAAAAAAFw/x6rKs2oFy-4/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-edz4hJFea1w/AAAAAAAAAAI/AAAAAAAAAFw/x6rKs2oFy-4/photo.jpg?sz=32)
Anmol Rastogi
92
92
Can you set boot parameters? (I don't use AWS)
â JanC
May 1 at 19:16
Idk how to set boot parameters. Thanks for suggesting though. :) Actually i found the solution. I detached my root volume from the instance and attached/mounted it on my other instance and then i opened up the mounted volume and remove the script and then detached it and attached it as root volume to the original instance. This worked as the script required was no longer there. So the system booted up perfectly. :)
â Anmol Rastogi
May 2 at 5:54
You can put your own answer in and accept it then. :)
â JanC
May 2 at 17:10
add a comment |Â
Can you set boot parameters? (I don't use AWS)
â JanC
May 1 at 19:16
Idk how to set boot parameters. Thanks for suggesting though. :) Actually i found the solution. I detached my root volume from the instance and attached/mounted it on my other instance and then i opened up the mounted volume and remove the script and then detached it and attached it as root volume to the original instance. This worked as the script required was no longer there. So the system booted up perfectly. :)
â Anmol Rastogi
May 2 at 5:54
You can put your own answer in and accept it then. :)
â JanC
May 2 at 17:10
Can you set boot parameters? (I don't use AWS)
â JanC
May 1 at 19:16
Can you set boot parameters? (I don't use AWS)
â JanC
May 1 at 19:16
Idk how to set boot parameters. Thanks for suggesting though. :) Actually i found the solution. I detached my root volume from the instance and attached/mounted it on my other instance and then i opened up the mounted volume and remove the script and then detached it and attached it as root volume to the original instance. This worked as the script required was no longer there. So the system booted up perfectly. :)
â Anmol Rastogi
May 2 at 5:54
Idk how to set boot parameters. Thanks for suggesting though. :) Actually i found the solution. I detached my root volume from the instance and attached/mounted it on my other instance and then i opened up the mounted volume and remove the script and then detached it and attached it as root volume to the original instance. This worked as the script required was no longer there. So the system booted up perfectly. :)
â Anmol Rastogi
May 2 at 5:54
You can put your own answer in and accept it then. :)
â JanC
May 2 at 17:10
You can put your own answer in and accept it then. :)
â JanC
May 2 at 17:10
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028424%2fstop-cron-job-constantly-rebooting-ec2-instance%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Can you set boot parameters? (I don't use AWS)
â JanC
May 1 at 19:16
Idk how to set boot parameters. Thanks for suggesting though. :) Actually i found the solution. I detached my root volume from the instance and attached/mounted it on my other instance and then i opened up the mounted volume and remove the script and then detached it and attached it as root volume to the original instance. This worked as the script required was no longer there. So the system booted up perfectly. :)
â Anmol Rastogi
May 2 at 5:54
You can put your own answer in and accept it then. :)
â JanC
May 2 at 17:10