Skip to content
Snippets Groups Projects
Commit 51d458cc authored by efer's avatar efer
Browse files

add options and rename launchd plist

parent 5361bcf7
No related branches found
No related tags found
No related merge requests found
......@@ -315,6 +315,10 @@ if [ $HOST_OS = 'Darwin' ]; then
if [ -d $H/Library/$SCRIPTNAME-$RUSER ]; then
mv $H/Library/$SCRIPTNAME-$RUSER $FILE_DIR/old/filter
fi
if [ -f $UNIT_DIR/com.dtucompute.backup.plist ]; then
launchctl bootout gui/$(id -u) $UNIT_DIR/com.dtucompute.backup.plist
mv $UNIT_DIR/com.dtucompute.backup.plist $FILE_DIR/old/
fi
elif [ $HOST_OS = 'Linux' ]; then
if [ -d $H/.config/$SCRIPTNAME-$RUSER ]; then
mv $H/.config/$SCRIPTNAME-$RUSER $FILE_DIR/old/filter
......@@ -602,27 +606,33 @@ chmod +x $BIN_DIR/$SCRIPTNAME
# Daemon files
#
if [ $HOST_OS = 'Darwin' ]; then
if [ ! -f $UNIT_DIR/com.dtucompute.backup.plist ]; then
cat > $UNIT_DIR/com.dtucompute.backup.plist << EOF
if [ ! -f $UNIT_DIR/local.comp-backup.plist ]; then
cat > $UNIT_DIR/local.comp-backup.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.dtucompute.backup</string>
<string>local.comp-backup</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/bin:/usr/bin:/usr/local/bin:$BIN_DIR</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>$BIN_DIR/$SCRIPTNAME</string>
</array>
<key>StandardErrorPath</key>
<string>$FILE_DIR/launchd.stderr</string>
<key>StartInterval</key>
<integer>10800</integer>
</dict>
</plist>
EOF
else
sed -i "" "s/$SCRIPTNAME-$RUSER/$SCRIPTNAME/" $UNIT_DIR/com.dtucompute.backup.plist
launchctl load $UNIT_DIR/local.comp-backup.plist
fi
elif [ $SYSTEMD = 1 ]; then
if [ -f $UNIT_DIR/$SCRIPTNAME-$RUSER.timer ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment