Perforce W/ Synology

Synology DS1515+ (DSM 6)

Perforce Binary : Helix Server Linux_86_64
useful start/stop script : https://forum.synology.com/enu/viewtopic.php?f=39&t=29558&p=310088#p310088


2 thoughts on “Perforce W/ Synology”

  1. scrap

    I had perforce all up and running on my DS211j but when I upgraded to DSM 5 I lost p4 so I just had to re-install. If there was an official package then it would have hopefully been ok. Anyway here is what I did to get perforce installed. There may be better directories to put the binaries but my Synology box is only used as a P4 server and internal file server so it works for me.

    login to your synology box using ssh as root

    cd /volume1/homes/admin
    wget ftp://ftp.perforce.com/perforce/r13.1/b … 6armel/p4d
    wget ftp://ftp.perforce.com/perforce/r13.1/b … 26armel/p4
    chmod +x p4
    chmod +x p4d

    for first time install
    mkdir /volume1/p4root

    test to see if we are working
    /volume1/homes/admin/p4d -r /volume1/p4root &

    use the following to work out the process id
    ps | grep p4d

    then do the following to kill the PID (the first number in the line from above)
    kill -9 PID

    cd /usr/syno/etc/rc.d
    touch S90p4d.sh
    vi S90p4d.sh

    paste the contents below into the file

    ——- start file after this line
    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: p4d
    # Required-Start: $local_fs $network $named $time $syslog
    # Required-Stop: $local_fs $network $named $time $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Description: perforce service
    ### END INIT INFO

    SCRIPT=’/volume1/homes/admin/p4d -r /volume1/p4root’
    RUNAS=root

    PIDFILE=/var/run/p4d.pid
    LOGFILE=/var/log/p4d.log

    start() {
    if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then
    echo ‘Service already running’ >&2
    return 1
    fi
    echo ‘Starting serviceā€¦’ >&2
    local CMD=”$SCRIPT &> \”$LOGFILE\” & echo \$!”
    su -c “$CMD” $RUNAS > “$PIDFILE”
    echo ‘Service started’ >&2
    }

    stop() {
    if [ ! -f “$PIDFILE” ] || ! kill -0 $(cat “$PIDFILE”); then
    echo ‘Service not running’ >&2
    return 1
    fi
    echo ‘Stopping serviceā€¦’ >&2
    kill -15 $(cat “$PIDFILE”) && rm -f “$PIDFILE”
    echo ‘Service stopped’ >&2
    }

    uninstall() {
    echo -n “Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] ”
    local SURE
    read SURE
    if [ “$SURE” = “yes” ]; then
    stop
    rm -f “$PIDFILE”
    echo “Notice: log file is not be removed: ‘$LOGFILE'” >&2
    update-rc.d -f p4d remove
    rm -fv “$0”
    fi
    }

    case “$1” in
    start)
    start
    ;;
    stop)
    stop
    ;;
    uninstall)
    uninstall
    ;;
    retart)
    stop
    start
    ;;
    *)
    echo “Usage: $0 {start|stop|restart|uninstall}”
    esac
    —— stop file above this line

    then test by
    ./S90p4d start
    ./S90p4d stop

    voila! You should now have p4 auto start each time you reboot

Leave a Reply