Question

Is there a way to pass a variable through a cron job? Example, currently I have a cron job setup like so:

* * * * * /bin/bash /Volumes/raid/farm_script/_apps/_scripts/farm_ping.sh

I'm wondering, is it possible to pass through info to the shell script from the cron job? Something similar to this perhaps:

* * * * * /bin/bash /Volumes/raid/farm_script/_apps/_scripts/farm_ping.sh 192.168.2.17

If so, how could I access this inside the farm_ping.sh file?

Was it helpful?

Solution

This is a positional parameter, accessible as $1. The next one would be $2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top