Need help creating a script
Hello i'm not strong at programming and scripting in linux so i'm hoping you csan help me.
i have a script that runs a restart command for a service. I want to add additional functions before it restarts this service. e.g file called script restart in file now that works: /etc/init.d/service restart I want to add to functions ahead of this restart command: cp file file.bak overwrite existing file quietly run edit.pl > file teh /etc/init.d/service restart |
And what exactly is your problem with doing that?
|
I do not know the proper syntaxt to be able to do this. I'm reading i have to use backticks, but even when i jsut put those lines in it does not work
|
So this is what i tried:
cp file file.bak edit.pl > file /etc/init.d/service restart |
Looks like it should work, as long as the perl-script in there has a proper shebang. Otherwise you need to start it with the Perl interpreter.
Please post what exactly you are doing and which error-messages exactly you are getting. |
Perl interpreter?
|
I have an application that calls on this script called restart. In that file it is a shortcut to restarting the service, and i want to add those 2 functions to that script. So once the application calls that script it makes a copy of a file, runs teh perl script and restarts the service.
|
this is what i have
perl -x '/etc/somedata/primary/addtofile.pl' > 'newfile' /etc/init.d/named restart |
We still don't know what the errors are you get. Without that nobody can help.
Also, those single quotes are not needed, so just remove them. |
All times are GMT -5. The time now is 09:23 PM. |