This is a discussion on crontab for root within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> hi all , I got one problem I want to write "1" into a file every three hours . ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| hi all , I got one problem I want to write "1" into a file every three hours . I want to use cron , beeing root ( using the root crontab). What i do is : -log in being root , -type "crontab -e root" -the file opened is not blank , there already is the hourly , dayly, monthly ... stuff into it , - i append this : 0 *3/ * * * echo 1 > /file_to_write_to - i save + close the editor - if i type "crontab -l root" , then the line i appended is not present . - if a wait , the job is not done . - if i directly edit /var/spool/cron/crontabs/root , by appending my line the line is then shown when i call crontab -l root . but was it the cleanest way ? - if i make the same procedure but with an user , all is OK . i dont have to edit /var/spool/cron/crontabs/$user what did i miss ? I run SLack 9.1 . Tnaks in advance for you help . -- http://mrakotom.free.fr |
| |||
| On Sun, 11 Jan 2004 13:08:45 +0100, Rakotomandimby <mrakotom@free.fr> wrote: > I want to use cron , beeing root ( using the root crontab). > What i do is : > -log in being root , > -type "crontab -e root" > -the file opened is not blank , there already is the hourly , dayly, > monthly ... stuff into it , > - i append this : > 0 *3/ * * * echo 1 > /file_to_write_to I think that should be 0 */3 * * * echo 1 > /file_to_write_to > - i save + close the editor > - if i type "crontab -l root" , then the line i appended is not present . > - if a wait , the job is not done . Are you using vim? If so, you might need to add ':set compatible' to make your crontab entry stick. The archives have more info about this, IIRC. -- Mark Hill <usenet@mark.ukfsn.org> (Yahoo address not read) GPG KeyID: 4A3B58AC |
| |||
| Mark Hill wrote: >> - i append this : >> 0 *3/ * * * echo 1 > /file_to_write_to > > I think that should be > 0 */3 * * * echo 1 > /file_to_write_to Yes it is ...it was just a typing error when copying it here... > Are you using vim? If so, you might need to add ':set compatible' to > make your crontab entry stick. The archives have more info about this, > IIRC. To avoid any troll-like thing , i did not mention my editor , but i use Emacs to do it . -- http://mrakotom.free.fr |
| |||
| On Sun, 11 Jan 2004 13:08:45 +0100, Rakotomandimby wrote: > hi all , > I got one problem > I want to write "1" into a file every three hours . > I want to use cron , beeing root ( using the root crontab). > What i do is : > -log in being root , > -type "crontab -e root" > -the file opened is not blank , there already is the hourly , dayly, > monthly ... stuff into it , > - i append this : > 0 *3/ * * * echo 1 > /file_to_write_to > - i save + close the editor > - if i type "crontab -l root" , then the line i appended is not present . > - if a wait , the job is not done . > > > - if i directly edit /var/spool/cron/crontabs/root , by appending my line > the line is then shown when i call crontab -l root . > but was it the cleanest way ? > > - if i make the same procedure but with an user , all is OK . i dont have to > edit /var/spool/cron/crontabs/$user > > what did i miss ? > > I run SLack 9.1 . > > Tnaks in advance for you help . Just curious, are you using vim or elvis as your editor? I also have the exact same problem and it seems to be related to vim and to .vimrc By default in slackware 9.1 /usr/bin/vi is a link to /usr/bin/elvis, which creates no problem in editing root's crontab with 'crontab -e root'. Now I don't use elvis so my /usr/bin/vi links to /usr/bin/vim instead, and again there is no problem using 'crontab -e root'. However, when I create a .vimrc file in /root, even if this file has nothing but comments in it, 'crontab -e root' suddenly stops registering changes to /var/spool/cron/crontabs/root, even though the temporary file created by crontab /var/spool/cron/crontab.XXX DOES register the changes I make. All the permissions seem to be ok, and I've run into this problem in every slack box I've worked on. I can still edit root's crontab directly of course, and every other user can edit their crontabs with 'crontab -e' using vim and the exact same ..vimrc in their home directories. It's simple enough to reproduce this problem: (as root) rm /usr/bin/vi ln -s /usr/bin/vim /usr/bin/vi touch ~/.vimrc crontab -e (and any changes won't be made to /var/spool/cron/crontabs/root) Any ideas? |
| |||
| Jazzcat wrote: > Any ideas? I found that : http://braille.uwo.ca/pipermail/spea...il/020328.html I think root's crontab is not editable ( according to the first line of this post .. ) I'm searching further ... -- http://mrakotom.free.fr |
| |||
| On Sun, 11 Jan 2004 13:28:47 +0000, Mark Hill wrote: > On Sun, 11 Jan 2004 13:08:45 +0100, > Rakotomandimby <mrakotom@free.fr> wrote: > >> I want to use cron , beeing root ( using the root crontab). >> What i do is : >> -log in being root , >> -type "crontab -e root" >> -the file opened is not blank , there already is the hourly , dayly, >> monthly ... stuff into it , >> - i append this : >> 0 *3/ * * * echo 1 > /file_to_write_to > > I think that should be > 0 */3 * * * echo 1 > /file_to_write_to > >> - i save + close the editor >> - if i type "crontab -l root" , then the line i appended is not present . >> - if a wait , the job is not done . > > Are you using vim? If so, you might need to add ':set compatible' to > make your crontab entry stick. The archives have more info about this, > IIRC. Just made a post to this thread. You're right setting vim to compatability mode fixes this. Doh! |
| ||||
| "Rakotomandimby" <mrakotom@free.fr> wrote: >> 0 */3 * * * echo 1 > /file_to_write_to > > Yes it is ...it was just a typing error when copying it here... > To avoid any troll-like thing , i did not mention my editor , but i use > Emacs to do it . Maybe it would help to do the following: crontab -l > /tmp/crontab.root emacs /tmp/crontab.root crontab /tmp/crontab.root I used to do it that way with Slackware 8. So far with Slackware 9.1 I have only added scripts to /etc/cron.* regards Henrik -- The address in the header is only to prevent spam. My real address is: hc2(at)uthyres.com Examples of addresses which go to spammers: synpunkt@svartalistan.com info@emailpromo.biz root@localhost |
| Thread Tools | |
| Display Modes | |
|
|