Quote:
Originally Posted by harry edwards
What about calling a script that calls the shutdown command. Although this shouldn't be necessary it will allow you to capture the output
|
Cron has been running a script for about 10 days now:
# m h dom mon dow command
05 01 * * * /sh/poweroff
the script is as follows:
Code:
#!/bin/bash
HOME=/home/peter
LOGNAME=peter
PATH=/sh:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
SHELL=/bin/bash
export HOME LOGNAME PATH SHELL
echo $(date) Running /bin/ls -Rl >> /sh/script.log
/bin/ls -Rl / 2> /dev/null 1> /tmp/files.lst
echo $(date) Done >> /sh/script.log
echo $(date) Running /sbin/shutdown -P now >> /sh/script.log
/sbin/shutdown -P now >> /sh/script.log
echo $(date) Done >> /sh/script.log
The script records the following to /sh/script.log:
---
Wed Jan 6 01:05:51 EST 2010 Running /sbin/shutdown -P now
Wed Jan 6 01:05:51 EST 2010 Done
.
.
.
Sun Jan 10 01:05:01 EST 2010 Running /bin/ls -Rl
Sun Jan 10 01:05:53 EST 2010 Done
Sun Jan 10 01:05:53 EST 2010 Running /sbin/shutdown -P now
Sun Jan 10 01:05:53 EST 2010 Done
---
Code:
grep "Jan 10 01:0[5-9]" /var/log/*
gives the output below. I don't know if it can help.
---
auth.log:Jan 10 01:05:01 janus CRON[12364]: pam_unix(cron:session): session opened for user root by (uid=0)
auth.log:Jan 10 01:05:53 janus CRON[12364]: pam_unix(cron:session): session closed for user root
auth.log:Jan 10 01:06:01 janus sudo: ebox : TTY=console ; PWD=/ ; USER=root ; COMMAND=/var/lib/ebox/tmp/gzQ64fQF2o.cmd
auth.log:Jan 10 01:06:02 janus sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
auth.log:Jan 10 01:06:02 janus sudo: pam_unix(sudo:session): session closed for user root
auth.log:Jan 10 01:06:02 janus sudo: ebox : TTY=console ; PWD=/ ; USER=root ; COMMAND=/var/lib/ebox/tmp/Q8ppxuOCY_.cmd
auth.log:Jan 10 01:06:02 janus sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
auth.log:Jan 10 01:06:02 janus sudo: pam_unix(sudo:session): session closed for user root
[50 similar lines suppressed]
daemon.log:Jan 10 01:05:53 janus init: tty4 main process (4312) killed by TERM signal
daemon.log:Jan 10 01:05:53 janus init: tty5 main process (4313) killed by TERM signal
daemon.log:Jan 10 01:05:53 janus init: tty2 main process (4315) killed by TERM signal
daemon.log:Jan 10 01:05:53 janus init: tty3 main process (4317) killed by TERM signal
daemon.log:Jan 10 01:05:53 janus init: tty6 main process (4319) killed by TERM signal
daemon.log:Jan 10 01:05:53 janus init: tty1 main process (10022) killed by TERM signal
daemon.log:Jan 10 01:05:54 janus init: ebox.apache2-user main process ended, respawning
daemon.log:Jan 10 01:06:02 janus dhclient: There is already a pid file /var/run/dhclient.eth0.pid with pid 7023
daemon.log:Jan 10 01:06:02 janus dhclient: killed old client process, removed PID file
daemon.log:Jan 10 01:06:02 janus dhclient: Internet Systems Consortium DHCP Client V3.0.6
daemon.log:Jan 10 01:06:02 janus dhclient: Copyright 2004-2007 Internet Systems Consortium.
daemon.log:Jan 10 01:06:02 janus dhclient: All rights reserved.
daemon.log:Jan 10 01:06:02 janus dhclient: For info, please visit
http://www.isc.org/sw/dhcp/
daemon.log:Jan 10 01:06:02 janus dhclient:
daemon.log:Jan 10 01:06:02 janus dhclient: Listening on LPF/eth0/00:11:43:0f:12:67
daemon.log:Jan 10 01:06:02 janus dhclient: Sending on LPF/eth0/00:11:43:0f:12:67
daemon.log:Jan 10 01:06:02 janus dhclient: Sending on Socket/fallback
daemon.log:Jan 10 01:06:02 janus dhclient: DHCPRELEASE on eth0 to 192.168.1.1 port 67
daemon.log:Jan 10 01:06:02 janus dhclient: send_packet: Network is unreachable
daemon.log:Jan 10 01:06:02 janus dhclient: send_packet: please consult README file regarding broadcast address.
daemon.log:Jan 10 01:06:08 janus init: ebox.loggerd main process (7868) killed by TERM signal
daemon.log:Jan 10 01:06:08 janus collectd[8257]: Exiting normally
daemon.log:Jan 10 01:06:14 janus collectd[8945]: Exiting normally
daemon.log:Jan 10 01:06:14 janus collectdmon[8944]: Info: collectd terminated with exit status 0
daemon.log:Jan 10 01:06:14 janus collectdmon[8944]: Info: shutting down collectdmon
debug:Jan 10 01:05:02 janus slapd[4546]: <= bdb_equality_candidates: (uidNumber) not indexed
debug:Jan 10 01:05:02 janus slapd[4546]: <= bdb_equality_candidates: (gidNumber) not indexed
debug:Jan 10 01:05:02 janus slapd[4546]: <= bdb_equality_candidates: (uidNumber) not indexed
debug:Jan 10 01:05:25 janus slapd[4546]: <= bdb_equality_candidates: (gidNumber) not indexed
debug:Jan 10 01:05:35 janus slapd[4546]: <= bdb_equality_candidates: (gidNumber) not indexed
debug:Jan 10 01:06:13 janus slapd[4546]: daemon: shutdown requested and initiated.
debug:Jan 10 01:06:13 janus slapd[4546]: slapd shutdown: waiting for 0 threads to terminate
debug:Jan 10 01:06:13 janus slapd[4546]: slapd stopped.
mail.err:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: ldap_result() failed: Can't contact LDAP server
mail.err:Jan 10 01:06:13 janus dovecot: auth(default): io_loop_handle_remove: epoll_ctl(2, 11): Bad file descriptor
mail.err:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: Can't connect to server: 127.0.0.1
mail.info:Jan 10 01:05:53 janus postgrey[4538]: 2010/01/10-01:05:53 Server closing!
mail.info:Jan 10 01:05:53 janus postgrey[4538]: Couldn't unlink "/var/run/postgrey.pid" [Permission denied]
mail.info:Jan 10 01:06:02 janus postfix/master[8150]: reload configuration /etc/postfix
mail.info:Jan 10 01:06:08 janus postfix/master[8150]: terminating on signal 15
mail.info:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: ldap_result() failed: Can't contact LDAP server
mail.info:Jan 10 01:06:13 janus dovecot: auth(default): io_loop_handle_remove: epoll_ctl(2, 11): Bad file descriptor
mail.info:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: Can't connect to server: 127.0.0.1
mail.log:Jan 10 01:05:53 janus postgrey[4538]: 2010/01/10-01:05:53 Server closing!
mail.log:Jan 10 01:05:53 janus postgrey[4538]: Couldn't unlink "/var/run/postgrey.pid" [Permission denied]
mail.log:Jan 10 01:06:02 janus postfix/master[8150]: reload configuration /etc/postfix
mail.log:Jan 10 01:06:08 janus postfix/master[8150]: terminating on signal 15
mail.log:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: ldap_result() failed: Can't contact LDAP server
mail.log:Jan 10 01:06:13 janus dovecot: auth(default): io_loop_handle_remove: epoll_ctl(2, 11): Bad file descriptor
mail.log:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: Can't connect to server: 127.0.0.1
mail.warn:Jan 10 01:05:53 janus postgrey[4538]: Couldn't unlink "/var/run/postgrey.pid" [Permission denied]
mail.warn:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: ldap_result() failed: Can't contact LDAP server
mail.warn:Jan 10 01:06:13 janus dovecot: auth(default): io_loop_handle_remove: epoll_ctl(2, 11): Bad file descriptor
mail.warn:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: Can't connect to server: 127.0.0.1
messages:Jan 10 01:05:54 janus smbd_audit: nobody|192.168.1.101|disconnect|ok|IPC$
messages:Jan 10 01:06:15 janus exiting on signal 15
syslog.0:Jan 10 01:05:01 janus /USR/SBIN/CRON[12365]: (root) CMD (/sh/poweroff)
syslog.0:Jan 10 01:05:02 janus slapd[4546]: <= bdb_equality_candidates: (uidNumber) not indexed
syslog.0:Jan 10 01:05:02 janus slapd[4546]: <= bdb_equality_candidates: (gidNumber) not indexed
syslog.0:Jan 10 01:05:02 janus slapd[4546]: <= bdb_equality_candidates: (uidNumber) not indexed
syslog.0:Jan 10 01:05:25 janus slapd[4546]: <= bdb_equality_candidates: (gidNumber) not indexed
syslog.0:Jan 10 01:05:35 janus slapd[4546]: <= bdb_equality_candidates: (gidNumber) not indexed
syslog.0:Jan 10 01:05:53 janus init: tty4 main process (4312) killed by TERM signal
syslog.0:Jan 10 01:05:53 janus init: tty5 main process (4313) killed by TERM signal
syslog.0:Jan 10 01:05:53 janus init: tty2 main process (4315) killed by TERM signal
syslog.0:Jan 10 01:05:53 janus init: tty3 main process (4317) killed by TERM signal
syslog.0:Jan 10 01:05:53 janus init: tty6 main process (4319) killed by TERM signal
syslog.0:Jan 10 01:05:53 janus init: tty1 main process (10022) killed by TERM signal
syslog.0:Jan 10 01:05:53 janus postgrey[4538]: 2010/01/10-01:05:53 Server closing!
syslog.0:Jan 10 01:05:53 janus postgrey[4538]: Couldn't unlink "/var/run/postgrey.pid" [Permission denied]
syslog.0:Jan 10 01:05:54 janus init: ebox.apache2-user main process ended, respawning
syslog.0:Jan 10 01:05:54 janus smbd_audit: nobody|192.168.1.101|disconnect|ok|IPC$
syslog.0:Jan 10 01:06:02 janus postfix/master[8150]: reload configuration /etc/postfix
syslog.0:Jan 10 01:06:02 janus dhclient: There is already a pid file /var/run/dhclient.eth0.pid with pid 7023
syslog.0:Jan 10 01:06:02 janus dhclient: killed old client process, removed PID file
syslog.0:Jan 10 01:06:02 janus dhclient: Internet Systems Consortium DHCP Client V3.0.6
syslog.0:Jan 10 01:06:02 janus dhclient: Copyright 2004-2007 Internet Systems Consortium.
syslog.0:Jan 10 01:06:02 janus dhclient: All rights reserved.
syslog.0:Jan 10 01:06:02 janus dhclient: For info, please visit
http://www.isc.org/sw/dhcp/
syslog.0:Jan 10 01:06:02 janus dhclient:
syslog.0:Jan 10 01:06:02 janus dhclient: Listening on LPF/eth0/00:11:43:0f:12:67
syslog.0:Jan 10 01:06:02 janus dhclient: Sending on LPF/eth0/00:11:43:0f:12:67
syslog.0:Jan 10 01:06:02 janus dhclient: Sending on Socket/fallback
syslog.0:Jan 10 01:06:02 janus dhclient: DHCPRELEASE on eth0 to 192.168.1.1 port 67
syslog.0:Jan 10 01:06:02 janus dhclient: send_packet: Network is unreachable
syslog.0:Jan 10 01:06:02 janus dhclient: send_packet: please consult README file regarding broadcast address.
syslog.0:Jan 10 01:06:08 janus init: ebox.loggerd main process (7868) killed by TERM signal
syslog.0:Jan 10 01:06:08 janus postfix/master[8150]: terminating on signal 15
syslog.0:Jan 10 01:06:08 janus collectd[8257]: Exiting normally
syslog.0:Jan 10 01:06:13 janus slapd[4546]: daemon: shutdown requested and initiated.
syslog.0:Jan 10 01:06:13 janus slapd[4546]: slapd shutdown: waiting for 0 threads to terminate
syslog.0:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: ldap_result() failed: Can't contact LDAP server
syslog.0:Jan 10 01:06:13 janus dovecot: auth(default): io_loop_handle_remove: epoll_ctl(2, 11): Bad file descriptor
syslog.0:Jan 10 01:06:13 janus dovecot: auth(default): LDAP: Can't connect to server: 127.0.0.1
syslog.0:Jan 10 01:06:13 janus slapd[4546]: slapd stopped.
syslog.0:Jan 10 01:06:14 janus collectd[8945]: Exiting normally
syslog.0:Jan 10 01:06:14 janus collectdmon[8944]: Info: collectd terminated with exit status 0
syslog.0:Jan 10 01:06:14 janus collectdmon[8944]: Info: shutting down collectdmon
syslog.0:Jan 10 01:06:15 janus exiting on signal 15
user.log:Jan 10 01:05:54 janus smbd_audit: nobody|192.168.1.101|disconnect|ok|IPC$
---