FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
341 views 0 comments
by anonymous
Hello,

I have a working custom script that is supposed to run in the background continuously . How can I achieve this?

2 Answers

0 votes
by anonymous

Hello,

You could use Crontab functionality: 

  • Log into the router using SSH client;
  • Use command crontab -e;
  • Add additional line to crontab, for example: ***** /root/test.sh

In this example script will run every single minute.

Crontab syntax explanation:

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │                                   7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>

Regards.

0 votes
by anonymous

You can use an ampersand (&) at the end of your command, for example:

somescript.sh &

and it will run in the backround after you execute it even if the terminal window is closed.