Sponsored Content
Full Discussion: cronjob Command for Shutdown
Operating Systems Linux Red Hat cronjob Command for Shutdown Post 302585987 by babinlonston on Friday 30th of December 2011 01:24:03 AM
Old 12-30-2011
MySQL

thank u mr.admin_xor & getrue

---------- Post updated at 11:54 AM ---------- Previous update was at 10:36 AM ----------

Quote:
Originally Posted by admin_xor
You can run a con job from a central machine to shutdown other machine using ssh. You need to configure ssh key sharing though for this to be working.

The below crontab entry will shutdown every machine specified in a file called /root/machines at 12 o'clock at night everyday (considering you are using Linux machines; syntax for shutting down other UNIX machines varies widely).
Code:
0 0 * * * '/bin/cat /root/machines | while read sys; do /usr/bin/ssh root@$sys "/sbin/shutdown -h now" 1>/dev/null 2>&1'

I assume you are already familiar with cron and how to schedule job with it. Below is the format for crontab entries. For detailed info, check the man page.

Code:
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

ya now i have checked the shutdown command its working fine , But im having Centos as my server and there r 50 Pcs with ubuntu , I want to shutdown all 50 Pcs @ 06:05 PM But it need warning message @ 5:55 PM is it possible how can i set the command pls help me
 

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
METCHE(8)						      System Manager's Manual							 METCHE(8)

NAME
metche - reducing root bus factor SYNOPSIS
metche [-h VSERVER] report (stable|testing|unstable)-YYYYMMDDHHMM metche [-h VSERVER] list metche [-h VSERVER] stabilize testing-YYYYMMDDHHMM DESCRIPTION
metche is a tool meant to ease collective system administration by monitoring changes in the system configuration. metche basic usage is to monitor changes in a directory, usually /etc; optionally, metche can also monitor: o one or more user maintained changelog files, o the state of Debian packages and versions. metche should be installed with a cronjob that regularly runs to automatically save the system state as needed. These states are saved in a way similar to the Debian development model: o unstable states are saved as soon as a change is detected. They are kept until a new testing state appears. o testing states is created from the last unstable state that has not been changed after a short amount of time (by default, one hour). Old unstable states are deleted afterwards. o stable states are created from the last testing state, either manually, or after a long amount of time (by default, 3 days). Old testing states are deleted afterwards. When a new testing state is saved, an email is sent to a configurable address, giving an overwiew of the differences with the previous testing. A notification is also sent when a new stable state is saved. metche's configuration is read from /etc/metche.conf. Various settings like changelog monitoring or time between system state switches are described there. OPTIONS
If -h VSERVER is specified, the VServer VSERVER is operated on instead of the host system. This, along with the VSNAMES option, allows one to monitor several VServers running on the system. One of the following commands must be specified on the command line: report When run with the report command, metche displays a report against the specified saved state, or if unspecified, against the latest testing state. This is useful when you have broken your system and want to know which changes have been made since a given, known working, system state. list When run with the list command, metche displays a list of all the saved states. stabilize When run with the stabilize command, metche turns a "testing state" into a "stable state". By default, it will use the last "test- ing state", but this can be overridden by giving a specific state as argument. cron This command should not be called manually, but used from a cronjob. When called, it can perform various operations like: saving "unstable", "testing" or "stable" states as needed and sending reports and notification if configured to do so. This command does not support the -h option. FILES
/etc/metche.conf contains metche configuration. When configured to monitor one changelog, CHANGELOG_FILE (default: /root/Changelog). When configured to monitor multiple changelogs, CHANGELOG_DIR/*/Changelog (default: /root/changelogs). System states are saved in BACKUP_DIR (default: /var/lib/metche). SECURITY
metche is able to use GnuPG to encrypt the email it sends, but does not by default; just enable the ENCRYPT_EMAIL configuration option, and make sure EMAIL_ADDRESS' public key is in root's keyring, trusted enough to be used blindly by metche. If EMAIL_ADDRESS is an email alias or mailing-list's address, you probably want to use the group option in /root/.gnupg/gpg.conf so that metche reports are encrypted for every person subscribed to this alias or mailing-list; for more information, see gpg(1). When DO_DETAILS is enabled and ENCRYPT_EMAIL is disabled, metche sends in clear text email the changes made to the watched directory... either make sure that the EXCLUDES configuration variable prevents it to send sensitive information, or triple check that secure connec- tions will be used end-to-end on the email path. If unsure, set EMAIL_ADDRESS configuration variable to a local mailbox. Please note that EMAIL_ADDRESS is not used for VServers: a VServer's report messages are sent to its root email address. metche stores, in BACKUP_DIR (default: /var/lib/metche), various backups of WATCHED_DIR. Make sure that this backup place is at least as secured as the source. BUGS
See metche's ticket system (https://labs.riseup.net/code/projects/metche/issues) for known bugs, missing features, and the development road-map. AUTHORS
metche and this manual page were written by the boum.org collective, and are now maintained by the metche developers collective <metche@lists.riseup.net>. metche user manual June 5, 2011 METCHE(8)
All times are GMT -4. The time now is 04:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy