forked from erikkugel/SlackBuilds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added init script and dedicated system account
- Loading branch information
Showing
3 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Create a user | ||
if [ -z "$(getent passwd transmission)" ]; then | ||
/usr/sbin/useradd -r -m -U -c "Transmission" transmission | ||
fi | ||
if ! [ -f /home/transmission/.config/transmission-cli/settings.json ]; then | ||
if ! [ -d /home/transmission/.config/transmission-cli ]; then | ||
mkdir -p /home/transmission/.config/transmission-cli | ||
fi | ||
transmission-daemon -d 2> /home/transmission/.config/transmission-cli/settings.json | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
# Start/stop/restart transmission. | ||
TRANSMISSION_USER="transmission" | ||
CMDLINE="transmission-daemon" | ||
|
||
# Start transmission: | ||
transmission_start() { | ||
echo "Starting TRANSMISSION daemon..." | ||
sudo -s -u ${TRANSMISSION_USER} ${CMDLINE} | ||
echo | ||
} | ||
|
||
# Stop transmission: | ||
transmission_stop() { | ||
echo -n "Stopping TRANSMISSION daemon..." | ||
killall -SIGINT -q ${CMDLINE} | ||
echo | ||
} | ||
|
||
# Reload transmission: | ||
transmission_reload() { | ||
echo -n "Reloading TRANSMISSION daemon..." | ||
killall -SIGHUP -q ${CMDLINE} | ||
echo | ||
} | ||
|
||
# Restart transmission: | ||
transmission_restart() { | ||
transmission_stop | ||
sleep 1 | ||
transmission_start | ||
} | ||
|
||
case "$1" in | ||
'start') | ||
transmission_start | ||
;; | ||
'stop') | ||
transmission_stop | ||
;; | ||
'restart') | ||
transmission_restart | ||
;; | ||
'reload') | ||
transmission_reload | ||
;; | ||
*) | ||
echo "usage $0 start|stop|restart|reload" | ||
esac |
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