--- On Sun, 4/12/09, Cameron Simpson <[email protected]> wrote:

> From: Cameron Simpson <[email protected]>
> Subject: Re: how to add stuff to crontab without using crontab -e
> To: [email protected], "Community assistance, encouragement, and advice 
> for using Fedora." <[email protected]>
> Date: Sunday, April 12, 2009, 8:35 PM
> On 12Apr2009 20:23, Antonio Olivares
> <[email protected]> wrote:
> | 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:
> 
> Something like:
> 
>   #!/bin/sh
>   set -ue
>   tmp=/tmp/crontab$$
>   crontab -l >"$tmp"
>   echo "15 16 * * 1-5 /usr/bin/poweroff >/dev/null
> 2>&1' >>"$tmp"
>   crontab "$tmp"
>   rm "$tmp"
> 
> maybe? Untested, but you get the idea I'm sure.
> 
> Cheers,
> -- 
> Cameron Simpson <[email protected]> DoD#743
> http://www.cskk.ezoshosting.com/cs/
> 
> I distrust a research person who is always obviously busy
> on a task.
> - Robert Frosch, VP, GM Research

Thank you very much Cameron and Jorge for responding.  I have done this, but I 
encounter the following error:

[oliva...@localhost Documents]$ cat edit-crontab
#!/bin/sh
set -ue
tmp=/tmp/crontab$$
crontab -l >"$tmp"
echo "15 16 * * 1-5 /usr/bin/poweroff >/dev/null 2>&1' >>"$tmp"
crontab "$tmp"
rm "$tmp"

[oliva...@localhost Documents]$ ./edit-crontab 
./edit-crontab: line 7: unexpected EOF while looking for matching `"'

I have encountered a few errors like this one when creating other scripts, and 
I have used the "`" character to help me, I will try to use it and see if it 
helps me get past this error?

Thanks a million.

Regards,

Antonio 


      

-- 
fedora-list mailing list
[email protected]
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Reply via email to