How can I run a bash script automatically?

2

I have a script named run.sh:

#!/bin/bash
cd /root/yowsup-master/src/
./yowsup-cli --interactive no --wait --autoack --config config.example

This script executes another script.

I tried adding my script path in /etc/rc.local but it doesn’t seem to work.

I also added it to startup application in Kali Linux it also doesn’t work.

I want my run.sh to execute automatically in the background when the computer starts.

Rishabh Sharma

Posted 2014-10-15T09:55:29.373

Reputation: 21

The labels do not represent the actual contents of this question. Even the title should talk about "a script" or "a command" instead of specifying bash.

Why the label "python"? – Raúl Salinas-Monteagudo – 2014-10-15T11:41:42.100

@RaúlSalinas-Monteagudo Is yowsup-cli working, I mean can you send and received messages ? – Nullpointer – 2017-06-22T10:31:29.477

Answers

7

Easy. Use a crontab entry like this:

@reboot  /replace/with/the/path/to/run.sh

To use that on your system, the best way is to never edit /etc/rc.local manually, but by just running crontab -e to edit your crontab entries. More details on this site.

JakeGould

Posted 2014-10-15T09:55:29.373

Reputation: 38 217