Run commands periodically without cron is possible?
In Linux - can run periodical commands without cron ??!??.......
Yeah, Running commands periodically without cron is possible when we go with "while".
As a command:
# while true; do <your command here> ; sleep 100; done &
Example: # while true; do echo "Hello World" ; sleep 100; done &
do not forget the last "&" as it will put your loop in the background.
Same way to call a script,
crate file name: while_check.sh
# cat while_check.sh
#!/bin/bash
while true; do /bin/sh script.sh ; sleep 100; done &
# cat script.sh
echo "Hello World"
# ./while_check.sh
Is it useful??
Yeah, Running commands periodically without cron is possible when we go with "while".
As a command:
# while true; do <your command here> ; sleep 100; done &
Example: # while true; do echo "Hello World" ; sleep 100; done &
do not forget the last "&" as it will put your loop in the background.
Same way to call a script,
crate file name: while_check.sh
# cat while_check.sh
#!/bin/bash
while true; do /bin/sh script.sh ; sleep 100; done &
# cat script.sh
echo "Hello World"
# ./while_check.sh
Is it useful??
Comments
Post a Comment