Deleted /etc/init.d/twonky ???

Post Reply
nanalisa
Posts: 18
Joined: Sat Feb 11, 2012 7:24 am

Deleted /etc/init.d/twonky ???

Post by nanalisa » Mon Feb 20, 2012 9:18 pm

Hello,

I fear I have emptied or deleted the Twonky-Ini file /etc/init.d/twonky... No idea how that happened. I was following the steps described in here http://buffalo.nas-central.org/wiki/Two ... ediaServer when it somehow dissapeared.

Anyway the command

Code: Select all

vi /etc/init.d/twonky
does only show empty lines now... :-/

And the listing with ls -l shows the following:

Code: Select all

-rwxrwxr-x 1 root root     0 Feb 20 15:50 twonky
Can anybody please post the original content of that file here?

Thank you very much in advance!!

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Deleted /etc/init.d/twonky ???

Post by Mijzelf » Tue Feb 21, 2012 8:07 am

Code: Select all

#!/bin/sh
#
# MediaServer Control File written by Itzchak Rehberg
# Modified for fedora/redhat by Landon Bradshaw <phazeforward@gmail.com>
# Adapted to TwonkyMedia 3.0 by TwonkyVision GmbH
# Adapted to TwonkyMedia 4.0 by TwonkyVision GmbH
#
# This script is intended for SuSE and Fedora systems. Please report
# problems and suggestions at http://www.twonkyvision.de/mantis/
#
#
###############################################################################
#
### BEGIN INIT INFO
# Provides:       twonkymedia
# Required-Start: $network $remote_fs
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Description:    TwonkyVision UPnP server
### END INIT INFO
#
# Comments to support chkconfig on RedHat/Fedora Linux
# chkconfig: 345 71 29
# description: TwonkyVision UPnP server
#
#==================================================================[ Setup ]===

WORKDIR1="/usr/local/TwonkyVision"
WORKDIR2="`dirname $0`"
PIDFILE=/var/run/twonky.pid

#=================================================================[ Script ]===

# Source function library.
if [ -f /etc/rc.status ]; then
  # SUSE
  . /etc/rc.status
  rc_reset
else
  # Reset commands if not available
  rc_status() {
    case "$1" in
	-v)
	    true
	    ;;
	*)
	    false
	    ;;
    esac
    echo
  }
  alias rc_exit=exit
fi


if [ -x "$WORKDIR1" ]; then
WORKDIR="$WORKDIR1"
else
WORKDIR="$WORKDIR2"
fi

DAEMON=twonkymedia
if [ ! -f "${WORKDIR}/${DAEMON}" ]
then
    DAEMON=twonkymusic
fi
TWONKYSRV="${WORKDIR}/${DAEMON}"

INIFILE="${WORKDIR}/twonkyvision-mediaserver.ini"

cd $WORKDIR

case "$1" in
  start)
    if [ -e /etc/iomnas/auth ]; then
        . /etc/iomnas/auth
        if [ "${media_enabled}" = "yes" ]; then
            if [ -e $PIDFILE ]; then
                PID=`cat $PIDFILE`
                echo "Twonky server seems already be running under PID $PID"
                echo "(PID file $PIDFILE already exists). killing existing server..."
                killall -s TERM twonkymedia twonkymediaserver
            fi
            if [ ! -x "${TWONKYSRV}" ]; then
                echo "Twonky servers not found".
                rc_status -u
                exit $?
            fi
            echo -n "Starting $TWONKYSRV ... "
            $TWONKYSRV -D -inifile "${INIFILE}"
            rc_status -v
        fi
    fi
  ;;
  stop)
    if [ ! -e $PIDFILE ]; then
      echo "PID file $PIDFILE not found, stopping server anyway..."
      killall -s TERM twonkymedia twonkymediaserver
      rc_status -u
      exit 3
    else
      echo -n "Stopping Twonky MediaServer ... "
      PID=`cat $PIDFILE`
      kill -s TERM $PID
      rm -f $PIDFILE
      rc_status -v
    fi
  ;;
  reload)
    if [ ! -e $PIDFILE ]; then
      echo "PID file $PIDFILE not found, stopping server anyway..."
      killall -s TERM twonkymedia twonkymediaserver
      rc_status -u
      exit 3
    else
      echo -n "Reloading Twonky server ... "
      PID=`cat $PIDFILE`
      kill -s HUP $PID
      rc_status -v
    fi
  ;;
  restart)
    $0 stop
    $0 start
  ;;
  status)
    if [ ! -e $PIDFILE ]; then
      running="`ps ax --no-headers | grep -e twonkymedia -e twonkymusic | grep -v grep | grep -v twonkymedia.sh | cut -d ' ' -f 1`"
      if [ "${running}" == "" ]; then
        echo "No twonky server is running"
      else
        echo "A twonky server seems to be running (PID: "${running}"), but no PID file exists."
        echo "Probably no write permission for ${PIDFILE}."
      fi
      exit 0
    fi
    PID=`cat $PIDFILE`
    running=`ps --no-headers -o "%c" -p $PID`
    if ( [ "${DAEMON}"=="${running}" ] ); then
      echo "Twonky server IS running."
    else
      echo "Looks like the daemon crashed: the PID does not match the daemon."
    fi
  ;;
  *)
    echo ""
    echo "Twonky server"
    echo "-------------"
    echo "Syntax:"
    echo "  $0 {start|stop|restart|reload|status}"
    echo ""
    exit 3
  ;;
esac

rc_exit

nanalisa
Posts: 18
Joined: Sat Feb 11, 2012 7:24 am

Re: Deleted /etc/init.d/twonky ???

Post by nanalisa » Tue Feb 21, 2012 7:38 pm

Thank you very much for your quick help.

Unfortunately I am not able to write the file.

After pasting the text into the file, and trying to save it, the pico editor says

Code: Select all

"Error writing /etc/init.d/twonky: no space left on device"
How is that possible?

Code: Select all

root@Iomega:/etc/init.d# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              4047936   4047936         0 100% /
tmpfs                    31012         0     31012   0% /lib/init/rw
udev                     10240      2520      7720  25% /dev
tmpfs                    31012         0     31012   0% /dev/shm
overflow                  1024         0      1024   0% /tmp
/dev/sda2            972492220 458755184 513737036  48% /nethdd
Trying to find out where it comes from:

Code: Select all

root@Iomega:/# ls -l
total 340
drwxrwxrwx  2 root root      4096 Feb 19 06:05 bin
drwxrwxrwx  2 root root      4096 Dec 31  1969 boot
drwxrwxrwx  2 root root      4096 Jun  1  2009 deb
drwxrwxrwx  2 root root      4096 Jun  1  2009 debootstrap
-rw-r--r--  1 root root       343 Dec 31  1969 debug
drwxr-xr-x 12 root root     12920 Feb 20 16:03 dev
drwxrwxrwx 65 root root      4096 Feb 20 16:04 etc
-rw-r--r--  1 root root    220134 Dec 31  1969 filelist
drwxrwxrwx  2 root root      4096 Dec 31  1969 flags
drwxr-xr-x  5 root root      4096 Feb 17 01:30 home
drwxrwxrwx 11 root root     12288 Feb 19 06:05 lib
-rwxr-xr-x  1 root root      2712 Dec 31  1969 linuxrc
drwx------  2 root root     16384 Jun  1  2009 lost+found
drwxr-xr-x  3 root root      4096 Feb 20 14:35 media
-rw-r--r--  1 root root       183 Jun 25  2009 mfg_out
drwxrwxrwx  2 root root      4096 Apr 11  2009 mnt
drwxrwxrwx 21  254     254   4096 Feb 21 14:31 nethdd
drwxr-xr-x  2 root root      4096 Jun  1  2009 opt
dr-xr-xr-x 63 root root         0 Dec 31  1969 proc
-rw-r--r--  1 root root         0 Jun 25  2009 ran_mfg
drwxrwxrwx  2 root root      4096 Dec 31  1969 restore
drwxrwxrwx  4 root root      4096 Feb 15 02:07 root
drwxrwxrwx  2 root root      4096 Feb 19 06:05 sbin
drwxr-xr-x  2 root root      4096 Sep 16  2008 selinux
drwxrwxrwx  3 root root      4096 Dec 31  1969 shl
drwxrwxrwx  2 root smbuser   4096 Feb 19 09:09 smb
drwxr-xr-x  2 root root      4096 Jun  1  2009 srv
drwxr-xr-x 13 root root         0 Feb 20 16:02 sys
drwxrwxrwt  4 root root       100 Feb 20 16:03 tmp
drwxrwxrwx 10 root root      4096 Dec 31  1969 usr
drwxrwxrwx 14 root root      4096 Feb 20 16:03 var
root@Iomega:/#
So it looks like the following file is very big:

Code: Select all

-rw-r--r--  1 root root    220134 Dec 31  1969 filelist
What can I do now? Do I need that file? Can I just delete it?

Thank you very much in advance!

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Deleted /etc/init.d/twonky ???

Post by Mijzelf » Tue Feb 21, 2012 8:17 pm

I don't know what 'filelist' is, but it's not big. The partition is 4GB, and that file is only 220kB.

Have a look in /tmp and /var/log, maybe that there are some very big files.

nanalisa
Posts: 18
Joined: Sat Feb 11, 2012 7:24 am

Re: Deleted /etc/init.d/twonky ???

Post by nanalisa » Wed Feb 22, 2012 6:10 am

Oh yes, you're right.
In the directories you are suggesting, can I delete everything?
Regarding their names they seem to hold only temporary and log files, nothing of importance?

I will have a closer look when I'm at home (in the office now).

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Deleted /etc/init.d/twonky ???

Post by Mijzelf » Wed Feb 22, 2012 10:26 am

Yes, you can safely delete everything. (You should not delete any subdirectories in /var/log/ but the files are OK).

Maybe some running programs will have problems with that, but after a reboot everything should be fine.

BTW, if there a some really big files there, note their names, and the size. Could be important to find out what is going on.

nanalisa
Posts: 18
Joined: Sat Feb 11, 2012 7:24 am

Re: Deleted /etc/init.d/twonky ???

Post by nanalisa » Wed Feb 22, 2012 9:23 pm

Code: Select all

root@Iomega:/home/nascentral# cd /tmp
root@Iomega:/tmp# ls -l
total 0
-rw-r--r-- 1 root root 0 Feb 20 16:03 cmderrfile
and

Code: Select all

root@Iomega:/var/log# ls -l
total 188
drwxr-xr-x 2 root        root   4096 Feb 15 03:00 apt
-rw-r--r-- 1 root        root   6910 Feb 15 03:02 aptitude
-rw-rw-r-- 1 root        utmp      0 Feb 15 03:28 btmp
-rw-r--r-- 1 root        adm    5688 Feb 20 16:02 dmesg
-rw-r--r-- 1 root        adm    5688 Feb 20 15:11 dmesg.0
-rw-r--r-- 1 root        adm    2397 Feb 20 14:55 dmesg.1.gz
-rw-r--r-- 1 root        adm    2426 Feb 20 14:15 dmesg.2.gz
-rw-r--r-- 1 root        adm    2538 Feb 19 09:15 dmesg.3.gz
-rw-r--r-- 1 root        adm    2538 Feb 19 06:27 dmesg.4.gz
-rw-r----- 1 root        adm   55168 Feb 19 06:08 dpkg.log
drwxr-s--- 2 Debian-exim adm    4096 Feb 21 06:25 exim4
drwxr-xr-x 2 root        root   4096 Sep 26  2010 fsck
-rw-rw-r-- 1 root        utmp 293168 Feb 22 15:52 lastlog
drwxrwxrwx 2 root        root   4096 Feb 19 00:25 lighttpd
-rw-rw-rw- 1 root        root    463 Feb 19 09:17 nasmon.log
drwxrwxrwx 3 root        root   4096 Feb 19 09:07 samba
-rw-r--r-- 1 root        root     70 Feb 20 15:02 smbconf.log
-rw-rw-r-- 1 root        utmp  49152 Feb 22 15:52 wtmp
both don't show any huge files either...

Code: Select all

 root@Iomega:/# find / -size +50000k
find: `/proc/13778/task/13778/fd/5': No such file or directory
find: `/proc/13778/task/13778/fdinfo/5': No such file or directory
find: `/proc/13778/fd/5': No such file or directory
find: `/proc/13778/fdinfo/5': No such file or directory
/usr/local/swap
/usr/local/TwonkyVision/twonkymedia.db/twonkymedia.main.db
/var/run/samba/locking.tdb
/var/run/samba/connections.tdb
root@Iomega:/#
There are a lot of other big files on /nethdd but as I get it right, that is another partition, isn't it?

Code: Select all

root@Iomega:/etc/init.d# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              4047936   4047936         0 100% /
tmpfs                    31012         0     31012   0% /lib/init/rw
udev                     10240      2520      7720  25% /dev
tmpfs                    31012         0     31012   0% /dev/shm
overflow                  1024         0      1024   0% /tmp
/dev/sda2            972492220 458755184 513737036  48% /nethdd
How can I find directories (not files) bigger than a certain size?

nanalisa
Posts: 18
Joined: Sat Feb 11, 2012 7:24 am

Re: Deleted /etc/init.d/twonky ???

Post by nanalisa » Thu Feb 23, 2012 6:36 am

Hello,

I found the folder and was able to free a lot of space. By mistake I had copied my photos to the first partition (/dev/sda1) instead of the second (/dev/sda2).
Now I was able to free a lot of space, renew the twonky ini file and restart the server. And yay, it is working again!! Thank you very much!

Post Reply