LINUX.ORG.RU

История изменений

Исправление serg002, (текущая версия) :

http://paste.debian.net/hidden/0279d47f/ я думаю, что запускалка никакого отношения к неубиваемому ff не имеет. Потому как точно такая же трабла имеется, скажем, у deluged

Исправление serg002, :

http://paste.debian.net/hidden/0279d47f/ я думаю, что запускалка никакого отношения к неубиваемому ff не имеет. Потому как точно такая же трабла имеется, скажем у deluged

Исправление serg002, :

filename=$(basename $0)
pids=($(pgrep -f $filename))
if [ ${#pids[@]} -gt 1 ]; then
    #echo "Script already running by pid ${pids[1]}"
    exit
fi

if [[ -f /etc/PROFILE ]]; then
    source /etc/PROFILE
fi




if [[ -x "$(command -v firefox)" ]]; then
    TARGET="firefox"
elif [[ -x "$(command -v firefox-bin)" ]]; then
    TARGET="firefox-bin"
fi
PRELOAD=""
ARGS=""
SLEEP=5


while true
do
    # if command available
    if [[ -x "$(command -v ${TARGET})" || -n ${TARGET} ]];then
        # sleep ${SLEEP}

        CMD_FREE=$(df -m "/home"  | awk 'NR==2{print $4}')
        # if space available
        if [[ "${CMD_FREE}" -lt 500 ]]; then
            if [[ -x "notify-send" || -n "notify-send" ]];then
               sudo -u $USER notify-send "Error: firefox not running. Not enough free disk space"
            fi
        else
            # if not runned
            if [[ -z $(pidof -x ${TARGET}) ]];then
               sudo -u $USER bash -c "${PRELOAD} ${TARGET} ${ARGS} >/dev/null 2>&1"
            fi
        fi

    fi
    sleep 15
done

я думаю, что запускалка никакого отношения к неубиваемому ff не имеет. Потому как точно такая же трабла имеется, скажем у deluged

Исправление serg002, :

filename=$(basename $0)
pids=($(pgrep -f $filename))
if [ ${#pids[@]} -gt 1 ]; then
    #echo "Script already running by pid ${pids[1]}"
    exit
fi

if [[ -f /etc/PROFILE ]]; then
    source /etc/PROFILE
fi




if [[ -x "$(command -v firefox)" ]]; then
    TARGET="firefox"
elif [[ -x "$(command -v firefox-bin)" ]]; then
    TARGET="firefox-bin"
fi
PRELOAD=""
ARGS=""
SLEEP=5


while true
do
    # if command available
    if [[ -x "$(command -v ${TARGET})" || -n ${TARGET} ]];then
        # sleep ${SLEEP}

        CMD_FREE=$(df -m "/home"  | awk 'NR==2{print $4}')
        # if space available
        if [[ "${CMD_FREE}" -lt 500 ]]; then
            if [[ -x "notify-send" || -n "notify-send" ]];then
               sudo -u $USER notify-send "Error: firefox not running. Not enough free disk space"
            fi
        else
            # if not runned
            if [[ -z $(pidof -x ${TARGET}) ]];then
               sudo -u $USER bash -c "${PRELOAD} ${TARGET} ${ARGS} >/dev/null 2>&1"
            fi
        fi

    fi
    sleep 15
done

Исходная версия serg002, :

filename=$(basename $0)
pids=($(pgrep -f $filename))
if [ ${#pids[@]} -gt 1 ]; then
    #echo "Script already running by pid ${pids[1]}"
    exit
fi

if [[ -f /etc/PROFILE ]]; then
    source /etc/PROFILE
fi




if [[ -x "$(command -v firefox)" ]]; then
    TARGET="firefox"
elif [[ -x "$(command -v firefox-bin)" ]]; then
    TARGET="firefox-bin"
fi
PRELOAD=""
ARGS=""
SLEEP=5


while true
do
    # if command available
    if [[ -x "$(command -v ${TARGET})" || -n ${TARGET} ]];then
        # sleep ${SLEEP}

        CMD_FREE=$(df -m "/home"  | awk 'NR==2{print $4}')
        # if space available
        if [[ "${CMD_FREE}" -lt 500 ]]; then
            if [[ -x "notify-send" || -n "notify-send" ]];then
               sudo -u $USER notify-send "Error: firefox not running. Not enough free disk space"
            fi
        else
            # if not runned
            if [[ -z $(pidof -x ${TARGET}) ]];then
               sudo -u $USER bash -c "${PRELOAD} ${TARGET} ${ARGS} >/dev/null 2>&1"
            fi
        fi

    fi
    sleep 15
done