crontab issues - need some help

sims

New Member
Joined
Jun 20, 2008
Messages
170
Reaction score
0
I would like to reboot my system every week or so. perhaps at 3am or so. would like to do a polite reboot such that if there is a call on, the system should wait for the call to complete.

1. i did crontab -r and entered the following line
3 3 * * 0-6 root /sbin/reboot > /dev/null

Problem 1: Nothing happenes. I have now discovered that /etc/crontab file looks completely different. Scratching my head as to why crontab -l shows a different two line listing including the one above!?

Problem 2: Now onto inserting the reboot line in /etc/crontab.
Or should I modify the line above somewhat to do polite rebooting? If so what should the line be?

Problem 3: When I invoke mail from command line, I see that there are thousands of mail collected. I think these are failed cronjobs or alert messages that are clogging up the mailbox. I recall that one can append another &> /dev/null to crontab command lines, to avoid the error messages. But i am thinking I should rather address the errors. Question: Is there a software other than mail installed using which I can browse the mails - I noticed Pine is not installed.
 
Hi

Have a look at webmin, that will provide an easy interface to create cronjobs, and to read mail

Joe
 
hi joe, fair suggestion.

i am a linux novice no doubt, but i think i can handle basic command line tasks with ease. this one was just quite puzzling in that crontab -l and crontab -e seem to be referring to a different file than the crontab files that i finally edited.
 
Crontab

Crontab -l lists the crontab of the user you are logged in as.
Crontab -e envokes your editor of choice and locks the file.
You are editing a temporary file until you save the file.
I believe if you set EDITOR=vi or some other choice that you will envoke that editor.

I always add this as the first lines in the crontab:
#-------------------------------------------------------------------------------
# min(0-59) hr(0-23) day(1-31) month(1-12) day-of-week(0-6 0=Sunday)
#-------------------------------------------------------------------------------
# Stored in: /var/spool/cron root or asterisk, etc.
#-------------------------------------------------------------------------------

Good Luck!
TomS
 
i login as root. so i think you are right - the crontab that runs must be the asterisk user cron job. i will investigate.

thanks!
 
I would like to reboot my system every week or so. perhaps at 3am or so. would like to do a polite reboot such that if there is a call on, the system should wait for the call to complete.

1. i did crontab -r and entered the following line
3 3 * * 0-6 root /sbin/reboot > /dev/null

Yeah, your edits via crontab -e will be under /var/spool/cron/root (provided your user is root at the time). For that crontab file your format is a little off. You should rewrite it like this:
Code:
3 3 * * 0-6 /sbin/reboot > /dev/null
(I removed the user specification of root.)
That will reboot the system daily at 03:03. It won't wait for a call to complete if someone is online, but it will reboot the system.

If you are editing the /etc/crontab then you can specify the user like you did above, but it's not necessary that you do. Unspecified users in that file are assumed to be root.

On a side note I wouldn't generally recommend unattended reboots of a production phone system, since if it's down you might not know it until you've missed many calls. If it works for you that's fine though - everyone has their own requirements.
 

Members online

Forum statistics

Threads
26,687
Messages
174,409
Members
20,257
Latest member
Dempan
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top