Jump to content
  • 0

BusyBox автозапуск crond


Леонид Харламов

Question

2 answers to this question

Recommended Posts

  • 0
6 часов назад, Леонид Харламов сказал:

Как настроить автозапуск крона после перезагрузки?

Debian, Entware?

Link to comment
Share on other sites

  • 0
Posted (edited)

Добавил скрипт S5crond для автозапуска в /opt/etc/init.d:

#!/bin/sh

SCRIPT=/opt/sbin/crond
PIDFILE=/opt/var/run/crond.pid
ARGS="-b"


start() {
  if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then
    echo 'Service crond is already running' >&2
    return 1
  fi
  $SCRIPT $ARGS
  echo 'Started crond service'
}

stop() {
  if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
    echo 'Service crond is not running' >&2
    return 1
  fi
  echo 'Stopping crond service...'
  kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
}

status() {
  if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then
    echo 'Service crond is running'
  else
    echo 'Service crond is stopped'
  fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|status}"
esac

 

Edited by Леонид Харламов
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...