Posted on 10-12-2012 04:24 PM
We will have a policy set up to run between 0000-0600 (using the every30 trigger), and we want it to run only if loginwindow is the active process.
So my thought is the policy will run a script, check running processes, if loginwindow is the process, run the rest of the script, else exit...
Any advice from the scripting gurus? Jared? Thomas? Sean? :)
Thanks,
Don
Solved! Go to Solution.
Posted on 10-12-2012 05:42 PM
When you say you want to test if the loginwindow is the active process, does that mean you want to only run the script when no one is logged in?
This script is checking the owner of the console. If it's root, then no one is logged in.
#!/bin/bash
current=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
if [[ $current != root ]]
then
/bin/echo "$current is logged in, exiting script..."
else
# run your script
fi
Posted on 10-12-2012 05:42 PM
When you say you want to test if the loginwindow is the active process, does that mean you want to only run the script when no one is logged in?
This script is checking the owner of the console. If it's root, then no one is logged in.
#!/bin/bash
current=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
if [[ $current != root ]]
then
/bin/echo "$current is logged in, exiting script..."
else
# run your script
fi
Posted on 10-13-2012 07:23 AM
@msblake wrote:
does that mean you want to only run the script when no one is logged in?
Yes we need to deploy something that requires an immediate reboot, so we want to do it off hours and only if the computer is logged off (at the login window).
Thanks,
Don