Calling external scripts
I would like to know the best method in order to call other scripts from another script. I have an antivirus program AntiVir that has its own startup/shutdown script, and I would like to call this from rc.local. How would I go about doing this? Thanks.
|
I suppose another option would be to place the startup/shutdown script for AntiVir in /etc/rc.d directory and making it executable. However, I just wanted to know for future reference how to call external scripts from another script.
|
Just as you would execute any program (a "script" is a shell program); invoke it by name with any arguments. If you look through the files in /etc/rc.d you'll notice that they're all shell programs (and, yes, you should be executing start up and shut down from /etc/rc.d if you want things running as daemons) and they execute other programs (be they shell or C or whatever) to start and stop services.
|
If the script you want to call is executable just call it by its' name. Otherwise you can use 'sh script_name'. There are other ways: source, '.' and exec.
Be sure to supply the full path to the script if it is not in your path. |
Quote:
A good way which also checks the executable status of your script would be to add these lines for a script called "rc.antivir: Code:
if [ -x /etc/rc.d/rc.antivir ]; then |
All times are GMT -5. The time now is 07:16 AM. |