Last active
May 26, 2022 10:35
-
-
Save coderofsalvation/d101f0b8b60d1778989866fd4546de76 to your computer and use it in GitHub Desktop.
start pods on boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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