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
Best answer by mscottblake
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 scriptfi
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 scriptfi
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).
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.