scan shared folders from command line/at timed intervals

If you have a suggestion for a feature, post it here

scan shared folders from command line/at timed intervals

Postby deadman » Wed Feb 04, 2009 3:39 pm

Hello, firstly thanks for a great media server for the ps3 (so glad to have found one that works so well with minimal need to fiddle for weeks with config files!)

Anyway, I'm currently running the mediaserver headless on an ubuntu server and everything works brilliantly (even set up a little init.d script to stop/start the mediaserver when my machine starts and stops), however there is no way to execute a scan of the shared folders without opening the gui (as far as I can tell).

Would it be possible to implement some sort of command that could be run from the command line to tell the mediaserver to re-scan the shared folders, or maybe have the mediaserver itself implement a re-scan at certain intervals?

Thanks


deadman
deadman
 
Posts: 2
Joined: Wed Feb 04, 2009 3:30 pm

Re: scan shared folders from command line/at timed intervals

Postby BlueBus » Thu Feb 05, 2009 5:31 pm

deadman,

could you please post your startup/shutdown script ?
thanks
BlueBus
 
Posts: 6
Joined: Thu Jan 22, 2009 4:32 pm

Re: scan shared folders from command line/at timed intervals

Postby deadman » Thu Feb 05, 2009 7:35 pm

Yeah. Here's how to get it running:

1. Copy the script below and paste into a text editor
2. Adjust lines 12 and 13 to match where you have your ps3mediaserver directory (mine is stored in a folder in my home directory hence the /home/blah)
Also, put the username that you want to run the ps3mediaserver as after "sudo -u " on line 13 (otherwise the script/server will run as root which isn't a good idea!)
3. save the file as "ps3mediaserver"
4. make the script exectuable (chmod +x ps3mediaserver)
5. copy ps3mediaserver script to /etc/init.d (sudo cp /wherever/you/saved/ps3mediaserver /etc/init.d/ps3mediaserver)
6. update the startup folders to include the new script (sudo update-rc.d ps3mediaserver defaults)

Now when you reboot you should have a self-starting media server. You can also start/stop it with the following commands:

sudo /etc/init.d/ps3mediaserver start
sudo /etc/init.d/ps3mediaserver stop

Anyway, here's the script:
Code: Select all
#! /bin/sh
# /etc/init.d/ps3mediaserver
#

# Some things that run always
touch /var/lock/ps3mediaserver

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting ps3mediaserver "
    cd /home/username/pms-linux-1.03
    sudo -u username /home/username/pms-linux-1.03/PMS.sh > /dev/null &
    echo "[OK]"
    ;;
  stop)
    echo "Stopping ps3mediaserver "
    kill -9 `pidof java`
    echo "[OK]"
    ;;
  *)
    echo "Usage: /etc/init.d/ps3mediaserver {start|stop}"
    exit 1
    ;;
esac

exit 0
deadman
 
Posts: 2
Joined: Wed Feb 04, 2009 3:30 pm

Re: scan shared folders from command line/at timed intervals

Postby BlkDougal » Fri Feb 20, 2009 7:56 pm

Cheers for the script mate.

To others reading this thread, consider changing this line in the script:

Code: Select all
    kill -9 `pidof java`


to this:

Code: Select all
    kill -9 `ps aux | grep pms.jar | head -1 | awk '{ print $2 }'`


If you are running any other java processes, the original line will kill all java processes. The new line will kill the FIRST process referencing the pms.jar file (which should only be PS3 Media Server we hope). I needed the head -1 (first process) because of quirkiness with my shell and gentoo. You may have to change 'head -1' to 'tail -1' or you might not need it at all.
BlkDougal
 
Posts: 2
Joined: Fri Feb 20, 2009 7:48 pm

Re: scan shared folders from command line/at timed intervals

Postby Irvysan » Wed Feb 25, 2009 2:18 am

Linux?
Irvysan
 
Posts: 77
Joined: Mon Jan 19, 2009 7:24 pm
Location: Somewhere Near Mars (Earth!)


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 7 guests