Difference between revisions of "Samba Spotlight Start Script"

m
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
#!/bin/sh
 
#!/bin/sh
  
SAMBA_DIR=/opt/samba
+
INSTALLDIR=/opt/samba
TRACKER_DIR="$SAMBA_DIR/var/tracker"
+
DBUS_PIDFILE="$INSTALLDIR/var/run/dbus"
DBUS_PIDFILE="$SAMBA_DIR/var/run/dbus"
 
  
 
dbus_env() {
 
dbus_env() {
    if [ ! -d "$TRACKER_DIR" ] ;
 
        then mkdir -p "$TRACKER_DIR"
 
    fi
 
 
     export DBUS_SESSION_BUS_ADDRESS="unix:path=$INSTALLDIR/var/run/spotlight.ipc"
 
     export DBUS_SESSION_BUS_ADDRESS="unix:path=$INSTALLDIR/var/run/spotlight.ipc"
    export HOME="$TRACKER_DIR"
 
 
     export TRACKER_USE_LOG_FILES=1
 
     export TRACKER_USE_LOG_FILES=1
 
}
 
}
Line 44: Line 39:
 
start_samba() {
 
start_samba() {
 
     printf "Starting Samba:"
 
     printf "Starting Samba:"
     "$SAMBA_DIR/bin/smbd"
+
     "$INSTALLDIR/bin/smbd"
 
     if [ $? -eq 0 ] ; then
 
     if [ $? -eq 0 ] ; then
 
         echo " [ok]"
 
         echo " [ok]"

Latest revision as of 12:26, 17 March 2016

#!/bin/sh

INSTALLDIR=/opt/samba
DBUS_PIDFILE="$INSTALLDIR/var/run/dbus"

dbus_env() {
    export DBUS_SESSION_BUS_ADDRESS="unix:path=$INSTALLDIR/var/run/spotlight.ipc"
    export TRACKER_USE_LOG_FILES=1
}

start_dbus() {
    printf "Starting dbus:"
    PID=`dbus-daemon --config-file="$INSTALLDIR/etc/dbus-session.conf" --print-pid --fork`
    echo $PID > "$DBUS_PIDFILE"
    sleep 1
    echo " [ok]"
}

stop_dbus() {
    printf "Stopping dbus:"
    if [ -f "$DBUS_PIDFILE" ] ; then
        kill `cat "$DBUS_PIDFILE"`
        rm "$DBUS_PIDFILE"
    fi
    echo " [stopped]"
} 

start_tracker() {
    printf "Starting Tracker:"
    tracker-control -s > /dev/null 2>&1
    if [ $? -eq 0 ] ; then
        echo " [ok]"
    else
        echo " [failed]"
    fi
}

start_samba() {
    printf "Starting Samba:"
    "$INSTALLDIR/bin/smbd"
    if [ $? -eq 0 ] ; then
        echo " [ok]"
    else
        echo " [failed]"
    fi
} 
  
stop_samba() {
    printf "Stopping Samba:"
    pkill smbd
    echo " [stopped]"
} 
  
case "$1" in
    start)
        dbus_env
        start_dbus
        start_tracker
        start_samba
        ;;
  
    stop)
        stop_samba
        stop_dbus
        ;;
  
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
        ;;
esac