Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top