Mini Shell
Direktori : /opt/sharedrads/ |
|
Current File : //opt/sharedrads/ctrl_alt_del |
#!/bin/bash
#Wrapper to get the environment when shutdown is called
rightnow=$(date +%s)
filename=$(echo -n "/root/shutdown-$rightnow.log")
echo "Shutdown log $filename" > $filename
echo "Open files of parent $PPID:" >> $filename
lsof -p $PPID >> $filename
echo >> $filename
echo "Parent/Child tree:" >> $filename
ps faux >> $filename
echo >> $filename
echo "Environment variables:" >> $filename
env >> $filename
echo >> $filename
echo "Arguments:" >> $filename
echo "shutdown $@" >> $filename
cat $filename | mail -s "Shutdown event on $(/bin/hostname) at $rightnow" steam@imhadmin.net
echo "This shutdown attempt has been logged. If you really need to shutdown the server, use the shutdown command."
Zerion Mini Shell 1.0