Cron Help! Need to edit a coldreboot command

GreatestOne

Limp Gawd
Joined
May 15, 2005
Messages
488
Someone told me to do this and it worked exactly for what I needed... but I set the timer for way too fast, how do I edit? I tried crontab -e and -i and I cant seem to find it... always something......

Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab


And another linux friend told me he would never ever use this type of command... is it just practice or can it damage my system?

The system is a super basic Debian running BAMT, for the sole purpose of mining/cracking blocks of code... I am doing nothing else with it. (in case u didnt know)

Thanks!
 
the /10 means every ten minutes. if you put a number there without the / it will happen whenever the clock says that minute.
 
You can overwrite the original file with this command. Notice the single '>'; that will overwrite anything in that file. So change the timing to whatever you want, and issue that command.

Then issue a SIGHUP to crond to reload the file, and you should be set.

Now, with that said; presumably "coldreboot" restarts the system. Why do you need to do that? I can't imagine a good reason to do that ( although I'm open to suggestion ). I'm 99% sure there's a better way to do what you are trying to accomplish.
 
Last edited:
Code:
echo "*/10 * * * * root coldreboot" > /etc/crontab
You can overwrite the original file with this command. Notice the single '>'; that will overwrite anything in that file. So change the timing to whatever you want, and issue that command.

Then issue a SIGHUP to crond to reload the file, and you should be set.

Now, with that said; presumably "coldreboot" restarts the system. Why do you need to do that? I can't imagine a good reason to do that ( although I'm open to suggestion ). I'm 99% sure there's a better way to do what you are trying to accomplish.

Thanks so much for getting back to me quickly... I think that worked... do I have to pass that SIGHUP command? If so, how do I do it, I am a total linux noob, sorry.

Yes, restarting the whole system... my system has been crashing a lot mining with that BAMT program that runs on a stripped Debian... and until I figure out exactly why it is crashing so often, I still cant afford to suffer that much downtime, especially when I out of the house or overnight, since every second lost is $$$ lost. Usually a reboot solves a freeze, so I thought I would preempt that with these reboots. I understand its a sucky bandaid but right now I dont think I have another choice.... do I?

Someone suggested why not just restart the mining process as the command rather than a full reboot, but I have had many times when that did not reset and activate, so then that would defeat the whole purpose.

Thanks again.
 
Thanks so much for getting back to me quickly... I think that worked... do I have to pass that SIGHUP command? If so, how do I do it, I am a total linux noob, sorry.

SIGHUP is signal 1 so

kill -1 pid
or
kill -HUP pid

you could also use killall to use the process name instead of pid (will affect all instances of the process name though)
 
Code:
echo "*/10 * * * * root coldreboot" > /etc/crontab
You can overwrite the original file with this command. Notice the single '>'; that will overwrite anything in that file. So change the timing to whatever you want, and issue that command.

Then issue a SIGHUP to crond to reload the file, and you should be set.

Actually, without the SIGHUP, it seemed to have just nixed the original, because now it is not restarting at all. I just reissued the original command with the two ">>"... maybe I shouldnt have...... ya, now still not restarting at all.... I'll need to learn how to use the SIGHUP......


SIGHUP is signal 1 so

kill -1 pid
or
kill -HUP pid

you could also use killall to use the process name instead of pid (will affect all instances of the process name though)

Sorry.... so at the terminal I just have to type in

kill -1 pid

?

How is using HUP different, and what is pid? You can just send me to a site if this is a lot to explain, I understand.

Thanks.
 
Last edited:
-1 and -HUP are the same. All the signals have names and numeric designations and you can use whichever you want (obviously, 1 is less to type than HUP ;)).

pid refers to the process id (same concept as in Windows). You can use ps to find the pid. e.g.
Code:
sean@drudenhaus ~ $ ps -ef | grep cron
root      2254     1  0 02:46 ?        00:00:00 /usr/sbin/cron
sean     15451  3024  0 19:35 pts/2    00:00:00 grep --colour=auto cron

The first result is the running instance of cron we're looking for and the pid is 2254 (1 is the parent pid). The second result is actually the grep process that was running looking for the cron process and can be ignored. If you managed to restart it this way you can stop reading this post as the rest is a few other ways to accomplish the same thing.

Using top is also easy. Run top, find the process (presumably using lots of CPU at the top so it's easy to find without sorting or doing any additional work), hit k, specify the pid, specify signal 1, done.

If you're using Debian, you can probably just use service to restart the cron daemon though. Perhaps,
Code:
service crond restart
where crond is the name of the service to restart. e.g. (note that my cron daemon is vixie-cron--this is probably not the case with your system)
Code:
drudenhaus sean # service vixie-cron restart
 * Stopping vixie-cron ...                                                   [ ok ]
 * Starting vixie-cron ...                                                   [ ok ]
 
-1 and -HUP are the same. All the signals have names and numeric designations and you can use whichever you want (obviously, 1 is less to type than HUP ;)).

pid refers to the process id (same concept as in Windows). You can use ps to find the pid. e.g.
Code:
sean@drudenhaus ~ $ ps -ef | grep cron
root      2254     1  0 02:46 ?        00:00:00 /usr/sbin/cron
sean     15451  3024  0 19:35 pts/2    00:00:00 grep --colour=auto cron

The first result is the running instance of cron we're looking for and the pid is 2254 (1 is the parent pid). The second result is actually the grep process that was running looking for the cron process and can be ignored. If you managed to restart it this way you can stop reading this post as the rest is a few other ways to accomplish the same thing.

Using top is also easy. Run top, find the process (presumably using lots of CPU at the top so it's easy to find without sorting or doing any additional work), hit k, specify the pid, specify signal 1, done.

If you're using Debian, you can probably just use service to restart the cron daemon though. Perhaps,
Code:
service crond restart
where crond is the name of the service to restart. e.g. (note that my cron daemon is vixie-cron--this is probably not the case with your system)
Code:
drudenhaus sean # service vixie-cron restart
 * Stopping vixie-cron ...                                                   [ ok ]
 * Starting vixie-cron ...                                                   [ ok ]

Ok, I think I did all that, but now after killing all, when I add the original
Code:
echo "*/20 * * * * root coldreboot" >> /etc/crontab

it doesnt reboot at 20 minutes anymore... its as if the killall command immunized the system from any future commands... am I missing something? Is the SIGHUP kill command to "kill" or to activate?
 
Ok, I think I did all that, but now after killing all, when I add the original
Code:
echo "*/20 * * * * root coldreboot" >> /etc/crontab

You modified /etc/crontab before restarting crond, correct?

it doesnt reboot at 20 minutes anymore... its as if the killall command immunized the system from any future commands... am I missing something? Is the SIGHUP kill command to "kill" or to activate?

The name "kill" is slightly misleading as it can do different things. If you don't specify a particular signal, it will indeed try to "kill" the process via the default signal, SIGTERM.

Signal 1, or SIGHUP, will generally tell a daemon to reload its configuration file, but that also assumes the software was written with signal handling for that particular signal. Since we don't actually know what implementation of cron you're using, it is possible such signal handling isn't implemented. You could use ps again to check if cron is running to determine if that is the issue or just restart it with service (see my previous post).
 
You modified /etc/crontab before restarting crond, correct?

The name "kill" is slightly misleading as it can do different things. If you don't specify a particular signal, it will indeed try to "kill" the process via the default signal, SIGTERM.

Signal 1, or SIGHUP, will generally tell a daemon to reload its configuration file, but that also assumes the software was written with signal handling for that particular signal. Since we don't actually know what implementation of cron you're using, it is possible such signal handling isn't implemented. You could use ps again to check if cron is running to determine if that is the issue or just restart it with service (see my previous post).

Not sure what u mean by modified that part up there, but I think I am slowly getting it...
Code:
root@bamt-miner:/home/user# killall cron
root@bamt-miner:/home/user# ps -ef | grep cron
root      6885  6595  0 05:02 pts/1    00:00:00 grep cron
root@bamt-miner:/home/user# service cron restart
Restarting periodic command scheduler: cron.
root@bamt-miner:/home/user# echo "*/20 * * * * root coldreboot" >> /etc/crontab
root@bamt-miner:/home/user# ps -ef | grep cron
root      6929     1  0 05:02 ?        00:00:00 /usr/sbin/cron
root      6955  6595  0 05:03 pts/1    00:00:00 grep cron
root@bamt-miner:/home/user# kill -1 6929
root@bamt-miner:/home/user# ps -ef | grep cron
root      6929     1  0 05:02 ?        00:00:00 /usr/sbin/cron
root      6973  6595  0 05:03 pts/1    00:00:00 grep cron

In my twisted head, this latest process was to:
1. Kill everything that was going on in cron
2. Check to see it was all killed
3. Restart the cron service with command u gave me (not sure if i was supposed to do this now or after the cron command line that comes next)
4. Set cron to reboot every 20 minutes
5. Check to see its there
6. use the kill -1 to "activate" it?
7. My OCD checking its still there

Is this even remotely kinda correct thinking and execution? (Waiting, ~T-10min for reboot hopefully) If so, at least now I know how to modify it properly... a little more complicated than I expected.
 
Nope, failed to execute again. Isnt killall the command to get back to square 1 basically? Previously when I first inputted
Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab
it worked perfectly, and I couldnt edit/cancel it... now I got it to cancel but I cant get it to execute if my life depended on it... this is just.... ya.... interesting.
 
You can overwrite the original file with this command. Notice the single '>'; that will overwrite anything in that file.

This was an extraordinarily bad idea because there could be all kinds of important stuff in the /etc/crontab file that just got blown away.

I suggest the OP get a copy of the original /etc/crontab file (from a backup? separate BAMT installation?) and start over.

If you want to change the crontab file you can simply edit it since it's just a text file: nano /etc/crontab.

The reason your system is freezing and crashing is a combination of your mining parameters probably not being stable and the fact that AMD's drivers are a heap of crap. I'd suggest trying to massage the mining configuration and start with something basic and stable to prevent the crashing.
 
Nope, failed to execute again. Isnt killall the command to get back to square 1 basically? Previously when I first inputted
Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab
it worked perfectly, and I couldnt edit/cancel it... now I got it to cancel but I cant get it to execute if my life depended on it... this is just.... ya.... interesting.

That's probably because it has no idea what the "coldreboot" program is since the PATH is unlikely defined now.

This is my plain vanilla crontab from Ubuntu 13.10, which may or may not be similar to your Debian distro:

Code:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
 
Execution of cron entries are generally reported in /var/log/syslog if you want to view that file and confirm that it's running your jobs.
 
Execution of cron entries are generally reported in /var/log/syslog if you want to view that file and confirm that it's running your jobs.

Thanks for the help...

I understand all the negatives of whats going on... and yes I am trying to finagle stable settings but just doing this cron thing so I dont lose $$$ for like 12+ hrs a day, thats kinda sucks.

This having been said, I am no closer to finding the solution for this one thing. Yes I can reinstall BAMT on the flash and start from scratch, although I am deathly scared of that now because the 4 flash drives I tried to do after that one does not work, and I heard BAMT can be real finicky with compatibilities. So if I can I would like to just edit the cron and get it working. However, last time I tried to run like a cron -e or cron -i (not sure) the file didnt know anything, as if I didnt even input that command.

Please keep in mind I am a total Linux noob, although I do have background in DOS/BASIC from 563789377 years ago, Linux is a whole new language for me, so I just need to know what precise syntax to type in the terminal in what order to get this working as painlessly as possible.

Thanks again.
 
Not sure what u mean by modified that part up there, but I think I am slowly getting it...
Code:
root@bamt-miner:/home/user# killall cron
root@bamt-miner:/home/user# ps -ef | grep cron
root      6885  6595  0 05:02 pts/1    00:00:00 grep cron
root@bamt-miner:/home/user# service cron restart
Restarting periodic command scheduler: cron.
root@bamt-miner:/home/user# echo "*/20 * * * * root coldreboot" >> /etc/crontab
root@bamt-miner:/home/user# ps -ef | grep cron
root      6929     1  0 05:02 ?        00:00:00 /usr/sbin/cron
root      6955  6595  0 05:03 pts/1    00:00:00 grep cron
root@bamt-miner:/home/user# kill -1 6929
root@bamt-miner:/home/user# ps -ef | grep cron
root      6929     1  0 05:02 ?        00:00:00 /usr/sbin/cron
root      6973  6595  0 05:03 pts/1    00:00:00 grep cron

In my twisted head, this latest process was to:
1. Kill everything that was going on in cron
2. Check to see it was all killed
3. Restart the cron service with command u gave me (not sure if i was supposed to do this now or after the cron command line that comes next)
4. Set cron to reboot every 20 minutes
5. Check to see its there
6. use the kill -1 to "activate" it?
7. My OCD checking its still there

Is this even remotely kinda correct thinking and execution? (Waiting, ~T-10min for reboot hopefully) If so, at least now I know how to modify it properly... a little more complicated than I expected.

No, it's two steps: edit /etc/crontab and restart the cron daemon.

If you blew away all of crontab then fix that first.
 
Thanks for the help...

I understand all the negatives of whats going on... and yes I am trying to finagle stable settings but just doing this cron thing so I dont lose $$$ for like 12+ hrs a day, thats kinda sucks.

This having been said, I am no closer to finding the solution for this one thing. Yes I can reinstall BAMT on the flash and start from scratch, although I am deathly scared of that now because the 4 flash drives I tried to do after that one does not work, and I heard BAMT can be real finicky with compatibilities. So if I can I would like to just edit the cron and get it working. However, last time I tried to run like a cron -e or cron -i (not sure) the file didnt know anything, as if I didnt even input that command.

Please keep in mind I am a total Linux noob, although I do have background in DOS/BASIC from 563789377 years ago, Linux is a whole new language for me, so I just need to know what precise syntax to type in the terminal in what order to get this working as painlessly as possible.

Thanks again.

I don't recommend that you re-install BAMT, but you need to get that /etc/crontab file back since it's garbage now. You can get this by installing BAMT on a new flash drive and copying it over or even simply asking somebody who has it already installed to post a copy. Perhaps ask on the Distributed Computing forum if there are any BAMT users there.

Once you have the original /etc/crontab in place you should be able to edit the file by doing "nano /etc/crontab" and then adding in that line for the coldreboot entry.
 
I don't recommend that you re-install BAMT, but you need to get that /etc/crontab file back since it's garbage now. You can get this by installing BAMT on a new flash drive and copying it over or even simply asking somebody who has it already installed to post a copy. Perhaps ask on the Distributed Computing forum if there are any BAMT users there.

Once you have the original /etc/crontab in place you should be able to edit the file by doing "nano /etc/crontab" and then adding in that line for the coldreboot entry.

I see, I see.... ok right now in the etc folder I see cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly, so the one I am looking for is just "crontab" correct?

I do have another BAMT drive already, doesnt work for some reason but files are there... I guess its too much to ask to be able to copy the file in Win7 right... I dont even see an etc folder through Win7. I ask because when I insert a second drive into my BAMT rig, I cant seem to access it... the included file manager seems useless in that root lists the bin, boot, dev etc. folders but elsewhere I cant find where another drive would be listed.

Do I have to use terminal, and if so, please help?
 
This was an extraordinarily bad idea because there could be all kinds of important stuff in the /etc/crontab file that just got blown away.
Yup, you're absolutely right. I wasn't paying all that much attention when I wrote this, obviously. My bad.
 
So................................ ?
Hang tight. My advice screwed you up, I'll help get you fixed up.

That was seriously a doh moment for me too. I feel like an idiot now. I think i was thinking it was a private cron file that was already empty.
 
I don't recommend that you re-install BAMT, but you need to get that /etc/crontab file back since it's garbage now. You can get this by installing BAMT on a new flash drive and copying it over or even simply asking somebody who has it already installed to post a copy. Perhaps ask on the Distributed Computing forum if there are any BAMT users there.

Once you have the original /etc/crontab in place you should be able to edit the file by doing "nano /etc/crontab" and then adding in that line for the coldreboot entry.

While I'm waiting, maybe I can just do this but need help... I can email myself the files that are needed, since it seems I dont know how to use file manager with drives in this system. The only thing is when I save an attachment in Iceweasel, I dont know how to specify a location to save it etc... to use it. Is this a viable way to get some of the cron files back? I can burn another BAMT drive anytime to get the files, actually have the ISO here I can just extract and send the files over.
 
You should only need one file (/etc/crontab). Because I'm completely unfamiliar with BAMT, I'm not sure how to go about doing things like mounting drives in the file manager. On something like Ubuntu, this kind of thing is done automatically, and there are tools (like Disk Utility) that can be used to do it manually if necessary.

If you can e-mail it to yourself and save it as an attachment or download it with a browser, that would work too. I don't know where attachments are saved but you could probably open a terminal and look for it:

cd ~
find . -name "crontab"

Once you find it you can just copy it to the /etc directory:

cp crontab /etc

You'll need admin privileges of course (if you don't already) to copy to the /etc directory and you'll have to specify the full path location of the source crontab file.

---

If you can e-mail yourself the file, can you just double-click the attachment and open it with a text editor and then save the file?
 
You should only need one file (/etc/crontab). Because I'm completely unfamiliar with BAMT, I'm not sure how to go about doing things like mounting drives in the file manager. On something like Ubuntu, this kind of thing is done automatically, and there are tools (like Disk Utility) that can be used to do it manually if necessary.

If you can e-mail it to yourself and save it as an attachment or download it with a browser, that would work too. I don't know where attachments are saved but you could probably open a terminal and look for it:

cd ~
find . -name "crontab"

Once you find it you can just copy it to the /etc directory:

cp crontab /etc

You'll need admin privileges of course (if you don't already) to copy to the /etc directory and you'll have to specify the full path location of the source crontab file.

Ya thats the thing, when I save the attachment it doesnt tell me where, so....

So I learned that find command, nice, it seems u have to type in the file + extension and have to be in the correct directory to work right. However the problem is I still do not know how to recognize and go to a new drive when I insert the USB with the files in there.

Ima just burn a new BAMT drive and put in the settings again... not worth the aggravation, since once I set it up again with cron working, this will all be moot.

Thanks for trying to help... at least a learned a little more linux... but in the future, what IS the proper way to edit a cron command like I needed to do from the OP here?
 
Double pointed brackets to append to the end of the file ">>" or just edit the file directly with vim/nano/somethingelse.

Ok, this is the original line that worked to execute for first time
Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab

Then I was told to use this to edit
Code:
echo "*/30 * * * * root coldreboot" > /etc/crontab

The problem came when trying to "refresh" or activate the new edit with the SIGHUP/kill stuff.

So u saying instead of using the last command with one ">" just type in
Code:
vim/nano/somethingelse
in the command line?

And what is that "somethingelse" supposed to be?

Sorry I know these are super noob questions but again, I really dont know ANY linux. All I wanna do is be able to execute cron for reboot and edit it if I need to change the time.
 
Yeah use nano...

nano /etc/crontab

Then you can add / delete whatever you want.

Of course if BAMT has a desktop environment you can just use any text editor that might be installed.

Just add */30 * * * * root coldreboot to the bottom of the file. After saving it it's probably easier to just reboot the machine than trying to get SIGHUP working.

If you want to try mounting your BAMT USB drive, you can try this...

Step 1: Remove USB drive.
Step 2: ls /dev/sd*
Step 3: Insert USB drive.
Step 4: ls /dev/sd*

- Find the latest mounted device not listed in Step 2 and the last partition number. It might be sdb2 or sdc1 or something like that. I think BAMT has two partitions and I think you want the second one, but I might be wrong on that.

Step 5: Make a mount point: mkdir -p /mnt/bamt
Step 6: Mount the drive: mount -t ext3 /dev/sdXY /mnt/bamt

- Replace X with the actual letter of the device and Y with the partition number found in Step 4. (So sdb2, sdc2, etc.)

Step 7: cd /mnt/bamt/etc

- crontab should be in there.

Step 8: cp crontab /etc/crontab

When you're done you have to leave the directory and unmount the drive before unplugging it:

cd
umount /mnt/bamt

(That's umount, not unmount.)
 
I'm going to assume "coldreboot" is a command that reboots the PC? So you never have time to edit the file before it reboots? Use a rescue CD to change it, or if you are not in a position to do that (ex: leased dedicated server) then do "service crond stop" as soon as you can get a console. Then you'll have all the time in the world to fix it.

You can even try spamming this on another Linux system while it reboots so you can catch it as soon as possible:

ssh [user@host] 'service crond stop'

If you have public keys setup, even better as you wont have to put in your username/password so less of a delay.
 
Ya thats the thing, when I save the attachment it doesnt tell me where, so....

Iceweasel like firefox defaults to a standard file download location. You can check it from the browser settings. This is also where you can change it to ask the path on every save.

Your files are probably saved already you just need to find them. 'locate' command is usually pretty good for that purpose. You can install it using apt-get install locate if you don't already have it.
 
Yeah use nano...

nano /etc/crontab

Then you can add / delete whatever you want.

Of course if BAMT has a desktop environment you can just use any text editor that might be installed.

Just add */30 * * * * root coldreboot to the bottom of the file. After saving it it's probably easier to just reboot the machine than trying to get SIGHUP working.

For now I had to test another version of BAMT anyways so i got a brand new USB working... so instead of putting in the old
Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab

I went to the editor via your
Code:
nano /etc/crontab

and I saw like SEVEN lines of
Code:
*/10 * * * * root coldreboot
*/10 * * * * root coldreboot
*/10 * * * * root coldreboot
*/30 * * * * root coldreboot
*/30 * * * * root coldreboot
*/30 * * * * root coldreboot

So I deleted all but one and set it to 60, restarted, but in an hour the system did not reboot. I know the command works because before when I used that shortcut command (not via nano) it did reboot after like 10 minutes.

I must be missing another step somewhere? Right now inside the crontab file, I just have
Code:
*/60 * * * * root coldreboot
 
That has me a bit confused.

The original, fresh, stock BAMT version /etc/crontab had those seven lines for coldreboot? Or are you referring to the version of crontab that you blew away with the echo commands?

The version you have right now that isn't working, can you post it? I don't know a lot about BAMT but there should be some stuff in there.
 
That has me a bit confused.

The original, fresh, stock BAMT version /etc/crontab had those seven lines for coldreboot? Or are you referring to the version of crontab that you blew away with the echo commands?

The version you have right now that isn't working, can you post it? I don't know a lot about BAMT but there should be some stuff in there.

The one i have in there right now, thats the one I posted.... I'm not sure whats going on either, I cant remember now if I tried this cron thing on the live drive either, but the one that I blew away is not being used right now, I pulled that out. So the info I gave up there most recently is whats live right now ATM.
 
Did you restart the cron daemon after editing /etc/crontab?

No, I thought I was just supposed to reboot the system sorry... how do I restart the daemon? I think someone else above tried to explain but maybe I didn't do it right, nothing went according to plan. Can u tell me exactly what I should type in the terminal?

I tried
Code:
system crond restart
and
Code:
system crontab restart
and both came up with errors
Code:
unrecognized service
 
Last edited:
No, I thought I was just supposed to reboot the system sorry... how do I restart the daemon? I think someone else above tried to explain but maybe I didn't do it right, nothing went according to plan. Can u tell me exactly what I should type in the terminal?

I tried
Code:
system crond restart
and
Code:
system crontab restart
and both came up with errors
Code:
unrecognized service

Rebooting would also suffice although you don't need to do that just to restart cron. I don't know what cron package you're using so I can't tell you exactly what to type. You'll have to poke around /etc/init.d/ and look for something with cron in the name.

e.g.

Code:
sean@drudenhaus ~ $ ls /etc/init.d/ | grep cron
vixie-cron
 
On my Ubuntu machine it's:

service cron restart


But if you did a reboot and that didn't work, a cron restart wouldn't do anything.
 
Rebooting would also suffice although you don't need to do that just to restart cron. I don't know what cron package you're using so I can't tell you exactly what to type. You'll have to poke around /etc/init.d/ and look for something with cron in the name.

e.g.

Code:
sean@drudenhaus ~ $ ls /etc/init.d/ | grep cron
vixie-cron

On my Ubuntu machine it's:

service cron restart

But if you did a reboot and that didn't work, a cron restart wouldn't do anything.

In init.d the only file concerning this is "cron". When I opened it, there was no line in there concerning the restart after 60 minutes.... is that normal? Or should I put that restart line at the end of this file?

I never tried

service cron restart

but after researching somewhere else, I just tried

sudo service cron restart

which did take, but again, this doesnt matter if my restart line is supposed to go into that cron file in init.d, or if it were good enough to just write that nano command line.... I dont understand what is the difference, why does there seem to be two places u can edit the cron option... which is correct or takes precedence?

And not sure if this matter but when I do a

Code:
crontab - l
then:
Code:
no crontab for root

When I do a
Code:
crontab - e
it opens up a file in
/tmp/crontab.NL8KnQ/crontab

So I'm thinking that nano command doesnt work for long term, shouldnt I be editing that file in etc/intit.d or using that -e command? And then using
Code:
/etc/init.d/crond.sh restart

This is confusing because I feel like there are 3 different cron edit locations, and its getting messy.

P.S. Rebooting per my last action did not result in the auto cron restart, so I am thinking I need to edit one of those files directly, but which one, the one in init.d or crontab -e, or are they the exact same thing?
 
Last edited:
The file in init.d is the daemon script. DO NOT edit that. It is not a configuration file!

Where is coldreboot located on the filesystem? Is it in one of the directories defined in the PATH variable?
 
Last edited:
The file in init.d is the daemon script. DO NOT edit that. It is not a configuration file!

Where is coldreboot located on the filesystem? Is it in one of the directories defined in the PATH variable?

How do I find that out? The only time I typed in the coldreboot command was in my initial

Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab

So the crontab -e should not be used to edit either?
 
How do I find that out? The only time I typed in the coldreboot command was in my initial

Code:
echo "*/10 * * * * root coldreboot" >> /etc/crontab

Slow way:
Code:
find / -name coldreboot
Fast way (if you have mlocate and an up to date database)
Code:
locate coldreboot
Fast way (if it's in your current PATH variable)
Code:
which coldreboot

So the crontab -e should not be used to edit either?

No, that should be fine too. I didn't say anything about crontab -e.
 
Back
Top