Skip to content

Instantly share code, notes, and snippets.

@rainly
Forked from chenshaoju/sunlogin.sh
Created March 17, 2022 07:40
Show Gist options
  • Save rainly/e0761a6ca90d985f324119dd00eb2bda to your computer and use it in GitHub Desktop.
Save rainly/e0761a6ca90d985f324119dd00eb2bda 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