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

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

 



On Monday, Apr 13th 2009 at 12:08 -0000, quoth Antonio Olivares:

=>
=>
=>
=>
=>--- On Mon, 4/13/09, Steven W. Orr <steveo@xxxxxxxxxxx> wrote:
=>
=>> From: Steven W. Orr <steveo@xxxxxxxxxxx>
=>> Subject: Re: how to add stuff to crontab without using crontab -e
=>> To: olivares14031@xxxxxxxxx, "Fedora List" <fedora-list@xxxxxxxxxx>
=>> 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@xxxxxxxxxx for rawhide/testing), but what I had there still works, but I cannot change it :(
=>
=>Regards,
=>
=>Antonio 

Now you're asking a totally different question. Someone with admin privs 
may or may not want to add you to cron.allow


-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux