Last active
December 30, 2019 14:37
-
-
Save nehabhardwaj01/e991a76b73d640243c3914d480686fa3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Start the run once job. | |
echo "Docker container has been started" | |
# Setup a cron schedule | |
echo "* * * * * /run.sh >> /var/log/cron.log 2>&1 | |
# This extra line makes it a valid cron" > scheduler.txt | |
crontab scheduler.txt | |
cron -f |
I think the line 7
and line 8
are on the same line. And the snippet should look like:
#!/bin/bash
# Start the run once job.
echo "Docker container has been started"
# Setup a cron schedule
printf "* * * * * /run.sh >> /var/log/cron.log 2>&1\n# This extra line makes it a valid cron" > scheduler.txt
crontab scheduler.txt
cron -f
@peter279k Yes, it can be rewritten in a single line as you suggested. The only difference is the former one serves better clarity.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks like it misses the
"
on line7
. And I think the fixed snippets are as follows: