September 2, 201312 yr Hello So I was trying to adapt a plugin and it has this line in its rc start srcipt: CMDLINE="sudo -u $RUNAS tvheadend -c $DATADIR -u $RUNAS -g $GROUP -f 2>&1 >/dev/null" $CMDLINE I have the following questions: If the 2>&1 >/dev/null stuff is meaning to silence all output, stdout and stderr, doesn't it have to be >/dev/null 2>&1 ?? If I try either of those commands, the syslog says: see next post for #2 Sep 2 01:42:21 Server sudo: root : TTY=pts/0 ; PWD=/etc/rc.d ; USER=root ; COMMAND=/usr/bin/tvheadend -c /mnt/cache/.apps/tvheadend -u root -g video -f > /dev/null 2>$stuff$1 and the command does not work properly. How can I avoid the $stuff$ ?? Thanks
September 4, 201312 yr Author I came to the idea that the $stuff$ thing had something to do with the syslog formatting in unmenu - And I was right. Anyway, there must be another reason why this does not work. The complete function looks like this. tvheadend_start() { # no-op if not enabled if [ $SERVICE != "enable" ]; then return fi # no-op if already running if [ -r /var/run/tvheadend.pid ]; then return fi # if directory doesn't exist or Tvheadend is not found, install it if [ ! -e "/usr/bin/tvheadend" ]; then tvheadend_install fi CMDLINE="sudo -u $RUNAS tvheadend -c $DATADIR -u $RUNAS -g $GROUP -f 2>&1 > /dev/null" echo "Starting Tvheadend: $CMDLINE" sleep 1 $CMDLINE while [ ! -e /var/run/tvheadend.pid ]; do sleep 1 done echo "... OK" sleep 1 } Now when i invoke it via /etc/rc.d/rc.tvheadend start, i get an error and an description on how tvheadend is used Starting Tvheadend: sudo -u root tvheadend -c /mnt/cache/.apps/tvheadend -u root -g video -f 2>&1 > /dev/null Usage: tvheadend [OPTIONS] Generic Options -h, --help Show this page ........... And the script is stuck (because tvheadend.pid isn't created) Now, when I abort the script and take that very codeline it echoed before "crashing" and paste it back in, it works... Any idea about that? How can I "debug" something like this?
Archived
This topic is now archived and is closed to further replies.