You are not logged in.

#1 2010-06-18 00:14:09

zfsd
Member
Registered: 2010-01-13
Posts: 15

Daemons and permissions

I'm trying to set permissions for files created with Deluge, but can't seem to get it right

The files are owned by the correct group/user, but the permissions are wrong.
I've put "muask 0" in my bash_profile, which works otherwise. Only when I start Deluge manually, the correct permissions are applied.
If I start Deluge as a Daemon, I only get permissions 644 (-rw-r--r--)
I suppose it's something wrong with the daemon-script..

Here's the line which starts the daemon:

[[ -z $PID ]] && su -l $DELUGE_USER -s /bin/sh -c "/usr/bin/deluged -l /var/log/deluged.log >/dev/null"

And the whole script:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/deluged

[[ -f /var/run/deluged.pid ]] && PID=$(cat /var/run/deluged.pid)
[[ -d /proc/$PID ]] || PID=

case "$1" in
  start)
    stat_busy "Starting Deluge Daemon"
    [[ -z $PID ]] && su -l $DELUGE_USER -s /bin/sh -c "/usr/bin/deluged -l /var/log/deluged.log >/dev/null"
    if [ $? -gt 0 ]; then
      stat_fail
    else
      sleep 1
      echo $(pgrep -u $DELUGE_USER deluged) > /var/run/deluged.pid
      add_daemon deluged
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping Deluge Daemon"
    [[ ! -z $PID ]] && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /var/run/deluged.pid
      rm_daemon deluged
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Thanks in advance!

Offline

Board footer

Powered by FluxBB