Genadinik
Genadinik

Reputation: 18649

Trying to edit crontab on a server which has more than one site

I edited my crontab, but the old setting still runs. Here is my crontab listing:

[root@semanticvalley etc]# for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
no crontab for root
no crontab for bin
no crontab for daemon
no crontab for adm
no crontab for lp
no crontab for sync
no crontab for shutdown
no crontab for halt
no crontab for mail
no crontab for news
no crontab for uucp
no crontab for operator
no crontab for games
no crontab for gopher
no crontab for ftp
no crontab for nobody
no crontab for dbus
no crontab for vcsa
no crontab for mailnull
no crontab for smmsp
no crontab for sshd
no crontab for apache
## ----- Begin HSPC generated text. Do not edit! ----- another_site.com
## ----- End HSPC generated text. ----- another_site.com

MAILTO=''
## ----- Begin HSPC generated text. Do not edit! ----- comehike.com
MAILTO='[email protected]'
30 13 * * * php /home/webadmin/comehike.com/html/utils/post_hike.php
## ----- End HSPC generated text. ----- comehike.com

MAILTO=''
no crontab for rpc
no crontab for popa3d
no crontab for pcap
no crontab for nscd
no crontab for rpm
no crontab for named
no crontab for mysql
no crontab for xfs
no crontab for spfmilt
no crontab for genadinik
## ----- Begin HSPC generated text. Do not edit! ----- somesite.com
## ----- End HSPC generated text. ----- somesite.com

But the site for which I set the new crontab is not even showing up in this listing. What do I have to change/edit to set it up correctly?

Just to clarify, this was the old crontab:

MAILTO=''
## ----- Begin HSPC generated text. Do not edit! ----- comehike.com
MAILTO='[email protected]'
30 13 * * * php /home/webadmin/some_url/some_path.php
## ----- End HSPC generated text. ----- comehike.com

and the new crontab which I have set is not even showing up here. But if I do cat /etc/crontab then the new settings do show up.

Thanks!

Upvotes: 0

Views: 342

Answers (1)

abhi.gupta200297
abhi.gupta200297

Reputation: 891

The right way to edit crontab is by doing:

crontab -e

If you want to do it from shell, or script for a user, you can also do:

less setting_file | crontab -u user

where setting_file is the file which contains your new settings. I hope that helps.

Upvotes: 3

Related Questions