mirror of
https://github.com/vikt0rm/dbus-goecharger.git
synced 2025-06-24 17:01:44 +02:00
add service scripts
This commit is contained in:
28
install.sh
Executable file
28
install.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
SERVICE_NAME=$(basename $SCRIPT_DIR)
|
||||
|
||||
# set permissions for script files
|
||||
chmod a+x $SCRIPT_DIR/restart.sh
|
||||
chmod 744 $SCRIPT_DIR/restart.sh
|
||||
|
||||
chmod a+x $SCRIPT_DIR/uninstall.sh
|
||||
chmod 744 $SCRIPT_DIR/uninstall.sh
|
||||
|
||||
chmod a+x $SCRIPT_DIR/service/run
|
||||
chmod 755 $SCRIPT_DIR/service/run
|
||||
|
||||
# create sym-link to run script in deamon
|
||||
ln -s $SCRIPT_DIR/service /service/$SERVICE_NAME
|
||||
|
||||
# add install-script to rc.local to be ready for firmware update
|
||||
filename=/data/rc.local
|
||||
if [ ! -f $filename ]
|
||||
then
|
||||
touch $filename
|
||||
chmod 755 $filename
|
||||
echo "#!/bin/bash" >> $filename
|
||||
echo >> $filename
|
||||
fi
|
||||
|
||||
grep -qxF "$SCRIPT_DIR/install.sh" $filename || echo "$SCRIPT_DIR/install.sh" >> $filename
|
4
restart.sh
Normal file
4
restart.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
kill $(pgrep -f "python $SCRIPT_DIR/dbus-goecharger-acload.py")
|
5
service/run
Normal file
5
service/run
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
exec 2>&1
|
||||
python $(realpath $SCRIPT_DIR/../dbus-goecharger-acload.py)
|
8
uninstall.sh
Normal file
8
uninstall.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
SERVICE_NAME=$(basename $SCRIPT_DIR)
|
||||
|
||||
rm /service/$SERVICE_NAME
|
||||
kill $(pgrep -f 'supervise dbus-goecharger-acload')
|
||||
chmod a-x $SCRIPT_DIR/service/run
|
||||
./restart.sh
|
Reference in New Issue
Block a user