Hello,
I have an Ubuntu 8.04 server that supplies gnump3d tunes, some http and serves as a test bed into my somewhat recent fascination with Linux. I love the flexibility of the platform and really enjoy rocking the CLI.
My question is: How can I write a script that will check to see if I am logged in and if it returns negative, shutdown the server.
I have tried (and forgive my ignorance, please. I have witnessed the awesome power of people helping with Linux and I must say it is amazing):
Code:
#!/bin/bash
if [ users=drew ]
then
echo You are logged in
else
shutdown -P now
fi
Now, as I understand, when I add this to /etc/crontab, It needs to be run by a user so I tried:
Code:
30 23 * * * * root NightKill
Whereas 'NightKill' is the script name.
If I have an extra *, disregard it. I wasn't copying from my actual crontab. How does one get this to work? I have googled, I have searched, I am new. Any help is appreciated.
/drew