[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: how to add stuff to crontab without using crontab -e






--- On Mon, 4/13/09, Steven W. Orr <steveo syslang net> wrote:

> From: Steven W. Orr <steveo syslang net>
> Subject: Re: how to add stuff to crontab without using crontab -e
> To: olivares14031 yahoo com, "Fedora List" <fedora-list redhat com>
> Date: Monday, April 13, 2009, 8:57 AM
> On Sunday, Apr 12th 2009 at 23:23 -0000, quoth Antonio
> Olivares:
> 
> =>
> =>Dear fellow Fedora users,
> =>
> =>I want to know if it is possible to edit/append to
> crontab without using crontab -e.  I have about 10 machines
> running Fedora and at the end of the day I have to manually
> power them off (shutdown).  For a while, I started thinking
> about it, well I can make a crontab to shutdown the machines
> at a certain time:
> =>
> =>Edit crontab to shutdown machines from student account
> at 4:15 every day(Monday-Friday) at school :)  This way I
> don't have to shut them down myself :)
> =>
> =>$ which poweroff
> =>
> =>
> =>If crontab is empty I want to add the following to it,
> so that the machines can shutdown by themselves at 4:15 pm. 
> 
> =>
> =># min hour day-of-month month day-of-week command
> =>15 16 * * 1-5 /usr/bin/poweroff  >& /dev/null
> =>
> =>I can manually type this for each of the 12 machines,
> but I thought it would be more efficient to do something
> like
> =>
> =>#!/bin/bash
> =>#
> =>crontab -e << "# min hour day-of-month
> month day-of-week command" \
> =>"15 16 * * 1-5 /usr/bin/poweroff  >&
> /dev/null " \
> =>EOF >>
> =>
> =>or something similar to apply it to all machines via a
> usb stick and avoid the typing. How can I correct the above
> script to do the job, if there is way to do it.
> =>
> =>I have done it manually and it will work, but how can
> I do it with a script to do it more efficiently?  
> =>
> =>Thank you in advance for your
> help/guidance/suggestions/advice.
> =>
> =>Regards,
> =>
> =>Antonio 
> =>
> 
> There have been a number of answers to your problem, none
> of which I like.
> 
> Your crontab is handwritten source code and needs to be
> treated as such. 
> You may not appreciate what I'm telling you until you
> actually one day 
> lose your crontab. Edit a file in your home directory
> called ~/.crontab 
> and use whatever editor you like. Make your crontab ref
> whatever programs 
> you want and then when your done, just run
> 
> crontab < ~/.crontab
> 
> to install it. You can check to see that it worked by just
> running 
> crontab -l
> 
> Does this help?
> 
> -- 

To be honest, I like all the answers provided and I like yours too!, 

Only 1 question, what would you do in a case where you get something like

$ crontab -l
Authentication service cannot retrieve authentication info
You (olivares) are not allowed to access to (crontab) because of pam configuration.

How would you deal with it?

I encountered this on rawhide and despite the fixes by selinux, I cannot access my crontab there(I know fedora-test-list redhat com for rawhide/testing), but what I had there still works, but I cannot change it :(

Regards,

Antonio 


      


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]