Sponsored Content
Top Forums Shell Programming and Scripting Triggering my Unix script.... Post 302225689 by buffoonix on Saturday 16th of August 2008 01:15:51 PM
Old 08-16-2008
Your CGI script will have to be executed by your web server.
You wrote you were using Apache.
So it depends how you configured your Apache.
I assume you haven't compiled a static Apache from the sources yourself
and mod_cgi gets loaded by default.
If I remember correctly you can query the httpd binary for what modules it would load with the current config.
(sorry, haven't got an Apache set up on my current surf box to confirm)
with something like (note, your path may vary)
Code:
# /usr/sbin/httpd -t -DDUMP_MODULES 2>&1 | grep cgi

Usually in the global section or within a vhost context of httpd.conf one would define a
ScriptAlias directory.
But it is also viable to set ExecCGI within a Directory context.
But the 1st being the more common method you will have to look up what path
your ScriptAlias points to.
(again, depending on your Unix/Linux the path to httpd.conf may deviate)
Try
Code:
# grep -i ^[^#]*scriptalias /etc/httpd/httpd.conf

The 2nd parameter to the ScriptAlias directive denotes the directory
where you must place your CGI scripts in.
The script doesn't necessarily have to be owned by the user that runs your Apache
(see what User is set to in the httpd.conf)
but it must be executable by this user (usually # chmod +x script.cgi will do.
But remeber, whatever the script will do must be permitted to the Apache user.
Then restart your web server (or send the parent httpd a SIGUSR1 or SIGHUP),
open a browser and point it to your CGI script in the URL of your ScriptAlias,
this time the URI path must be the first argument from the ScriptAlias directive,
often something like http://your.webserver.fqdn/cgi-bin/yourscript.cgi

Last edited by buffoonix; 08-16-2008 at 02:22 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

triggering utility

gang, I have a need for a utility that will 'watch' a directory and when a file pops into it, it will run a script on the file. More specifically, it will pgp decrypt the file that pops into the directory. Our Security guys aren't comfortable with the 'normal' users on our system being able... (1 Reply)
Discussion started by: hedrict
1 Replies

2. Windows & DOS: Issues & Discussions

Urgent Need for Assistance: Triggering Windows bat files from UNIX

Hello, Is there a way to trigger a Windows bat file or program on a different machine from a different UNIX server using KSC file? I hope you can assist me with this. Thanks! (0 Replies)
Discussion started by: punyenye
0 Replies

3. Shell Programming and Scripting

Triggering a Script Recursively With Different Parameter and in Different Process

Hi Every One I have a Compilation Script name scomp which takes the Program name as the command line argument I have around 10000 Programs to compile while each program takes around 10 mins to compile i have written a Mass Compile script Scripts which takes the list of programs as input... (15 Replies)
Discussion started by: pbsrinivas
15 Replies

4. UNIX for Dummies Questions & Answers

Script triggering Korn shell, how-to stop it?

Script_A.sh has echo "In am in script A" ksh ## K-shell is invoked. Script B.sh ## which I am writing... ./script_A.sh echo "I am in script B" return 0 When I run: $> Script_B.sh $> I am in script A $> Basically, on calling Script_A.sh from within Script_B.sh I have the issue of... (2 Replies)
Discussion started by: baivab
2 Replies

5. Solaris

Triggering UNIX command from Web Browser

HI, I want to trigger a UNIX command from a web browser page. The web browser will have few steps which will generate the UNIX command and then it should connect to the UNIX box and fire that command. Here we are using Sun Solaris UNIX. Can you please suggest me how can i get... (6 Replies)
Discussion started by: dear_abhi2007
6 Replies

6. UNIX for Dummies Questions & Answers

Unix coding for triggering informatica

Hi, I have very little knowledge with unix and pmcmd. I need help with a issue. I have to see whether a file has been dropped in a particular location/path. If the file dropped I have to check the last modified time, which should be greater than 8pmEST the prior day. If the file has been... (4 Replies)
Discussion started by: redwolves
4 Replies

7. Shell Programming and Scripting

Triggering remote UNIX shell script from Remote desktop

I m trying to run a batch script in remote desktop which executes unix commands on the unix server...the problem is i wnt the output in HTML format.so in my batch script i m giving the cmd like ssh hostname path ksh HC_Report.ksh>out.html ...but it generates the HTML file in remote desktop .i... (2 Replies)
Discussion started by: navsan
2 Replies

8. Shell Programming and Scripting

Triggering UNIX Script from a JAVA program

Hi I am trying to implement one program, where JAVA needs to trigger the backend UNIX script. Tried with options like String cmdArray = {"/bin/ksh","-c","/SCRIPT_ABSOLUTE_PATH/sampleScript.ksh /FILE_ABSOLUTE_PATH Test_File.dat TEST E SFTP"} When I trigger the script from front end with... (1 Reply)
Discussion started by: karumudi7
1 Replies

9. Shell Programming and Scripting

Triggering a script using POSTFIX....

I have a mail server configured on my server (Postfix), I have a script which requires input to be provided to it. I would like to know if there is a possibility to trigger this script by sending mail to the server. This is what I am thinking: Once the mail arrives on server, the mail will... (6 Replies)
Discussion started by: davidbob
6 Replies
NPM-RUN-SCRIPT(1)														 NPM-RUN-SCRIPT(1)

NAME
npm-run-script - Run arbitrary package scripts SYNOPSIS
npm run-script <command> [--silent] [-- <args>...] alias: npm run DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. As of ` https://blog.npmjs.org/post/98131109725/npm-2-0-0, you can use custom arguments when executing scripts. The special option -- is used by getopt https://goo.gl/KxMmtG to delimit the end of the options. npm will pass all the arguments after the -- directly to your script: npm run test -- --grep="pattern" The arguments will only be passed to the script specified after npm run and not to any pre or post script. The env script is a special built-in command that can be used to list environment variables that will be available to the script at run- time. If an "env" command is defined in your package, it will take precedence over the built-in. In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write: "scripts": {"test": "tap test/*.js"} instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests. The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of ` https://github.com/npm/npm/releases/tag/v5.1.0 you can customize the shell with the script-shell configuration. Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full path you were in when you ran npm run. npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten. You can use the --silent flag to prevent showing npm ERR! output on error. You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. SEE ALSO
o npm help 7 scripts o npm help test o npm help start o npm help restart o npm help stop o npm help 7 config January 2019 NPM-RUN-SCRIPT(1)
All times are GMT -4. The time now is 06:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy