Sponsored Content
Full Discussion: cronjob Command for Shutdown
Operating Systems Linux Red Hat cronjob Command for Shutdown Post 302586024 by admin_xor on Friday 30th of December 2011 02:30:43 AM
Old 12-30-2011
You can run the cron job at 5:55 PM with the following modifications. It's better if you could save the script in a file and make it executable and run it in cron.
Code:
#!/bin/bash

# initshut.sh file
/bin/cat /root/machines | while read sys; do
   # let's put it in the background and move on to the next machine
   ( /usr/bin/ssh root@$sys '/sbin/shutdown -h +10 "The system is going down after 10 minutes. Please save your work and log off before that. --Admin"' ) &
done

Please note the single and double quotes. Without their proper usage, the command will not be executed.

Then, make a crontab entry like this:
Code:
55 17 * * * '/root/initshut.sh >/dev/null 2>&1'


Last edited by admin_xor; 12-30-2011 at 03:40 AM..
This User Gave Thanks to admin_xor For This Post:
 

10 More Discussions You Might Find Interesting

1. Solaris

shutdown question from command line

solaris 10 logged in as root to command line...want to shut the system down....could not do this....when i chose shutdown the system seemed to squawk at me saying i'd lose whatever i was working on would be lost unless i logged out...after proceeding through this it took me to the gui log in... (6 Replies)
Discussion started by: drisnya
6 Replies

2. Shell Programming and Scripting

Need a cronjob command

Dear Exerts, I want to schedule a script which could run after every 35 minutes. please find below the command but it is not woring and running after every 35 minutes. 35 * * * * /opt/home/backup/test_dir/abc.sh > /opt/home/backup/test_dir/abc_cronlog.txt Please tell me what is the problem... (7 Replies)
Discussion started by: shary
7 Replies

3. AIX

shutdown command

Hi, After issuing shutdown -F or shutdown -F now my server is getting restarted. Any Idea? (3 Replies)
Discussion started by: manoj.solaris
3 Replies

4. UNIX for Dummies Questions & Answers

Script to force Oracle database shutdown when shutdown immediate does not work

I have Oracle 9i R2 on AIX 5.2. My Database is running in shared server mode (MTS). Sometimes when I shutdown the database it shutsdown cleanly in 4-5 mints and sometimes it takes good 15-20 minutes and then I get some ora-600 errors and only way to shutdown is by opening another session and... (7 Replies)
Discussion started by: aixhp
7 Replies

5. OS X (Apple)

Problems using shutdown -u command

I have a smart-ups connected to my OS X Snow Leopard server ver. 10.6. Based on the docs and forums I read, I have been trying to use the software provided by APC, PCNS. I have also tried to just use the UPS communications cable provided and use the OS' "UPS options". Neither of them work exactly... (1 Reply)
Discussion started by: mckorn99
1 Replies

6. AIX

Shutdown command

Hi, is there a difference between shutdown -Fand shutdown -h now? (3 Replies)
Discussion started by: x_adm
3 Replies

7. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

8. Shell Programming and Scripting

Exit script when shutdown or reboot command is given

This is probably a simple question, but I'm new with writing scripts for Linux (IPFire in this case) and Google wasn't helpful with this. When creating a script, what is the best and/or proper way to have it exit automatically if the reboot or shutdown command is given? If that's even... (2 Replies)
Discussion started by: bartgrefte
2 Replies

9. UNIX for Dummies Questions & Answers

Top Command Output is not coming via Cronjob

Dear All, I created a small script to get the CPU, GIS usage etc automatically. However when i run this script manually its working , but when i run through cronjob i am not getting any output. Can anyone please help me on this. I am using SuseLinux. Thank you in advance. #!/bin/sh {... (2 Replies)
Discussion started by: Nitin Kapoor
2 Replies

10. Shell Programming and Scripting

Issue with shutdown command in script (MacOS High Sierra)

Hello, I have a backup script that runs an rsync backup to an external drive. I use the script frequently on Windows and Linux and have installed it on a Mac. The script has an option to run shutdown after the backup has completed. Since backup can take hours to run, this is an option that is... (10 Replies)
Discussion started by: LMHmedchem
10 Replies
LDAP2REPOSITORY(1)					User Contributed Perl Documentation					LDAP2REPOSITORY(1)

NAME
ldap2repository - creating debian repositories cronjob for the GOsa FAI plugin. SYNOPSIS
ldap2repository [-hvnpej] [-c config] [-d outdir] [-r srvroot] [-i interface] [-a arch] [-P proxy] DESCRIPTION
ldap2repository is a script to create the cronjob for the local. debian repositories needed by GOsa FAI plugin. -c LDAP config file (default: /etc/ldap/ldap.conf) -d output dir (default: /etc/gosa/fai) -h display this help and exit -n skip cleanup for mirrors -p show progress in cronjob -v be verbose -i network interface (default: eth0) -j create a new /etc/cron.d/goto-fai-backend -r server root (default: /srv/www) -e ignore small errors -a processor architecture (default: i386) -P proxy (default: none) BUGS
Please report any bugs, or post any suggestions, to the GOsa mailing list <gosa-devel@oss.gonicus.de> or to <https://oss.gonicus.de/labs/gosa> LICENCE AND COPYRIGHT
This code is part of GOsa (<http://www.gosa-project.org>) Copyright (C) 2005-2006 Jan-Marek Glogowski <glogow@fbihome.de> 2007-2010 The GOsa project <gosa-devel@oss.gonicus.de> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. perl v5.10.0 2010-05-19 LDAP2REPOSITORY(1)
All times are GMT -4. The time now is 09:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy