Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Last active May 26, 2022 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderofsalvation/d101f0b8b60d1778989866fd4546de76 to your computer and use it in GitHub Desktop.
Save coderofsalvation/d101f0b8b60d1778989866fd4546de76 to your computer and use it in GitHub Desktop.
start pods on boot
#!/bin/sh
# usage:
# 1. put podi project;s in /home/foo/projectname
# 2. to disable podboot create /home/foo/projectname/podi.stop
# 3. install service using './startpods install'
start(){
apps="$(find /home/*/*/podi)"
for app in $apps; do
test -f $app".noboot" && continue
user=$(echo $app | awk -F'/' '{ print $3 }')
su $user -c "$app start"
done
}
install(){
echo '[Unit]
Description=start podi pods
[Service]
ExecStart='$(pwd)/startpods' start
[Install]
WantedBy=multi-user.target' > /lib/systemd/system/startpods.service
systemctl daemon-reload
systemctl enable startpods.service
read -p "start now? (y/n)" start
test start = y && systemctl start startpods.service
systemctl status startpods.service
}
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment