-
Notifications
You must be signed in to change notification settings - Fork 86
/
install_systemd.sh
executable file
·32 lines (26 loc) · 863 Bytes
/
install_systemd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
USER=`whoami`
PWD=`pwd`
FRIEND_RUN_DIRECTORY=$PWD/build
TMP=/tmp/friendcore.service
echo "Writing systemd script to temporary file $TMP"
echo '[Unit]' > $TMP
echo 'Description=Friend Core' >> $TMP
echo 'After=network.target' >> $TMP
echo '[Service]' >> $TMP
echo 'Type=simple' >> $TMP
echo "User=$USER" >> $TMP
echo "WorkingDirectory=$FRIEND_RUN_DIRECTORY" >> $TMP
echo "ExecStart=$FRIEND_RUN_DIRECTORY/FriendCore" >> $TMP
echo 'Restart=always' >> $TMP
echo 'RestartSec=3' >> $TMP
echo 'StandardOutput=null' >> $TMP
echo '[Install]' >> $TMP
echo 'WantedBy=multi-user.target' >> $TMP
echo "Copying temporary file $TMP to /etc/systemd/system"
sudo cp $TMP /etc/systemd/system/
echo ''
echo "Use standard systemd commands to control Friend Core:"
echo "systemctl start friendcore"
echo "systemctl stop friendcore"
echo "systemctl restart friendcore"