Skip to content

Instantly share code, notes, and snippets.

@chenshaoju
Created March 16, 2022 08:23
Show Gist options
  • Save chenshaoju/08d2318b3ebe0935a2dde2b2845d06be to your computer and use it in GitHub Desktop.
Save chenshaoju/08d2318b3ebe0935a2dde2b2845d06be to your computer and use it in GitHub Desktop.
auto enable/start sunlogin services and running, disable/stop services when exit sunlogin.
#!/usr/bin/sudo bash
#
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
systemctl enable runsunloginclient.service
systemctl start runsunloginclient.service
# change USERNAME to your current non-root username
sudo -u USERNAME /usr/local/sunlogin/bin/sunloginclient &
wait $!
systemctl stop runsunloginclient.service
systemctl disable runsunloginclient.service
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment