how to add stuff to crontab without using crontab -e

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

 



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 


      

-- 
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