Determine if user is logged in via CLI?
Posted: Sun Feb 17, 2013 7:54 pm
Is there any way to determine if a user is logged in via CLI or on desktop?
I've got this script which mounts user directories on login, and do not want it to execute certain parts when the user is logged in via CLI:
I've got this script which mounts user directories on login, and do not want it to execute certain parts when the user is logged in via CLI:
Code: Select all
if [ "$USER" != "root" ]; then
pulseaudio --start&
g15aiostats&
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=1&
# User profile setup
# Variables
NW_MNTD=/home/$USER/.network
# Remove redundant stuff
rmdir ~/Documents ~/Music ~/Pictures ~/Videos ~/Public
# Change user folder permissions
chmod 0700 /home/$USER
# Create softlinks
ln -sf $NW_MNTD/$USER/Documents ~/Documents
ln -sf $NW_MNTD/$USER/Music ~/Music
ln -sf $NW_MNTD/$USER/Pictures ~/Pictures
ln -sf $NW_MNTD/$USER/Videos ~/Videos
ln -sf $NW_MNTD/Media ~/Media
if grep -qs $NW_MNTD/Admin /proc/mounts; then
ln -sf $NW_MNTD/Admin ~/Admin
fi
fi