SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
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.
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.
Merely placing a script in /etc/rc.d and making it executable won't make Slackware run it automatically - you will still have to add it to rc.local.
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
# echo "Starting AntiVirdaemon: /etc/rc.d/rc.antivir start"
/etc/rc.d/rc.antivir start
fi
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.