Format : for i in {1..N} ;
do <command>;done;
Eg :
for i in {1..100} ; do sleep 2;echo `date`;done;
for i in {1..100} ; do sleep 2;echo `date`;done;
Let’s say you want to start a script every time you start your linux machine (Ubuntu) and stop
Create your script eg : ‘myScript’
1. sudo vim /etc/init.d/myScript or ‘vi’ to write the script.
3. sudo update-rc.d myScript defaults 98 02 [98 and 02 are the start
and stop sequence numbers respectively]
myScript above accept start and stop as arguments . Refer your ‘tomcat’ script in /etc/init.d/tomcat if you want to know how to accept above arguments (if you dont have stop , then it will retry same thing at shutdown). my above script eg is for start/stop vpn.
Source reference from: https://help.ubuntu.com/community/UbuntuBootupHowto