Sponsored Content
Top Forums Shell Programming and Scripting understanding the purpose of <If env | grep -q $EXAMPLE> Post 303041873 by croyleje on Thursday 5th of December 2019 02:39:36 PM
Old 12-05-2019
understanding the purpose of <If env | grep -q $EXAMPLE>

I have seen this code in a few places and my understanding is they are using it to determine what app called the script.

I have a script that is called by two different applications and what it to do one thing when called by one and something else when called by the other. How do I determine what app is calling the script? If my example is correct how would I determine the $EXAMPLE and is every running application assigned a variable name?

I thought about just writing a separate script but the script is caching some info from one app and then echoing out to the other app when it asks for it so I think it should stay as one script.

Any help or pointing me in the correct direction would be great.
Thank you,
Jason
 

10 More Discussions You Might Find Interesting

1. Programming

Understanding the purpose of dup/dup2

I'm having difficulty understanding the purposes of using dup/dup2 when involving forks. for example, if we call fork() once, that is, we are creating a child process. In what cases would we need to use dup or dup2 to duplicate the file descriptors for standard output and standard error? What... (1 Reply)
Discussion started by: Yifan_Guo
1 Replies

2. Shell Programming and Scripting

Adding command line env in cron env

Hello friends, i run two scripts manually & they work. i run them in cron & they don work. how to match the two env's 1.command line env 2.cron env i would like cron to use command line env. Thanks & Regards Abhijeet (1 Reply)
Discussion started by: abhijeetkul
1 Replies

3. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

4. UNIX for Dummies Questions & Answers

Purpose of /etc/cron.d

What is the purpose of /etc/cron.d? (3 Replies)
Discussion started by: proactiveaditya
3 Replies

5. UNIX for Advanced & Expert Users

Purpose of inv

Hi All Can anybody tell me what is the purpose of inv in the below command. ftp -inv $RFTPSERVER /temp/te.txt << EOF and << its stands for what.. Thanks (1 Reply)
Discussion started by: raju4u
1 Replies

6. Web Development

Deny from env=env-variable Does not work

(Above from Apache docs). On my system, using: SetEnvIf User-Agent Mozilla IsBad=1 Order allow,deny Allow from all Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Discussion started by: gnurob
1 Replies

7. Shell Programming and Scripting

Understanding pattern matching used in a grep command

I have the following code. I want to remove the --sort=num/num/... and am using grep to exclude it as shown below: I have a bit of problem figuring out the use of - at the front echo "--sort=4/5/6" | grep -ivE '-((sort|group)=+/+(/+)*)$' Now suppose I want to remove --quiet I can... (7 Replies)
Discussion started by: kristinu
7 Replies

8. UNIX for Dummies Questions & Answers

Purpose of <>

Hi, I have read from the book that , <> causes the file to be used as both input as well as output. Can anyone give me the scenario where <> will be useful? Thanks (10 Replies)
Discussion started by: pandeesh
10 Replies

9. Shell Programming and Scripting

help understanding regex with grep & sed

I have the following line of code that works wonders. I just don't completely understand it as I am just starting to learn regex. Can you help me understand exactly what is happening here? find . -type f | grep -v '^\.$' | sed 's!\.\/!!' (4 Replies)
Discussion started by: trogdortheburni
4 Replies

10. Shell Programming and Scripting

Further understanding the Grep! lol

If I use the grep command for parsing files, does it stop parsing right after it finds the matching pattern or does it continue to parse that document? grep -l "status" *.xml (5 Replies)
Discussion started by: emc^24sho
5 Replies
Catalyst::Manual::Deployment::Apache::FastCGI(3pm)	User Contributed Perl Documentation	Catalyst::Manual::Deployment::Apache::FastCGI(3pm)

NAME
Catalyst::Manual::Deployment::Apache::FastCGI - Deploying Catalyst with FastCGI on Apache Setup 1. Install Apache with mod_fastcgi mod_fastcgi for Apache is a third-party module, and can be found at <http://www.fastcgi.com/>. It is also packaged in many distributions (for example, libapache2-mod-fastcgi in Debian). You will also need to install the FCGI module from CPAN. Important Note! If you experience difficulty properly rendering pages, try disabling Apache's mod_deflate (Deflate Module), e.g. 'a2dismod deflate'. Apache 1.x, 2.x Apache requires the mod_fastcgi module. The same module supports both Apache 1 and 2. There are three ways to run your application under FastCGI on Apache: server, static, and dynamic. Standalone server mode FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket Alias /myapp/ /tmp/myapp.fcgi/ # Or, run at the root Alias / /tmp/myapp.fcgi/ # Optionally, rewrite the path when accessed without a trailing slash RewriteRule ^/myapp$ myapp/ [R] The FastCgiExternalServer directive tells Apache that when serving /tmp/myapp to use the FastCGI application listening on the socket /tmp/mapp.socket. Note that /tmp/myapp.fcgi MUST NOT exist -- it's a virtual file name. With some versions of "mod_fastcgi" or "mod_fcgid", you can use any name you like, but some require that the virtual filename end in ".fcgi". It's likely that Apache is not configured to serve files in /tmp, so the Alias directive maps the url path /myapp/ to the (virtual) file that runs the FastCGI application. The trailing slashes are important as their use will correctly set the PATH_INFO environment variable used by Catalyst to determine the request path. If you would like to be able to access your app without a trailing slash (http://server/myapp), you can use the above RewriteRule directive. Static mode The term 'static' is misleading, but in static mode Apache uses its own FastCGI Process Manager to start the application processes. This happens at Apache startup time. In this case you do not run your application's fastcgi.pl script -- that is done by Apache. Apache then maps URIs to the FastCGI script to run your application. FastCgiServer /path/to/myapp/script/myapp_fastcgi.pl -processes 3 Alias /myapp/ /path/to/myapp/script/myapp_fastcgi.pl/ FastCgiServer tells Apache to start three processes of your application at startup. The Alias command maps a path to the FastCGI application. Again, the trailing slashes are important. Dynamic mode In FastCGI dynamic mode, Apache will run your application on demand, typically by requesting a file with a specific extension (e.g. .fcgi). ISPs often use this type of setup to provide FastCGI support to many customers. In this mode it is often enough to place or link your *_fastcgi.pl script in your cgi-bin directory with the extension of .fcgi. In dynamic mode Apache must be able to run your application as a CGI script so ExecCGI must be enabled for the directory. AddHandler fastcgi-script .fcgi The above tells Apache to run any .fcgi file as a FastCGI application. Here is a complete example: <VirtualHost *:80> ServerName www.myapp.com DocumentRoot /path/to/MyApp # Allow CGI script to run <Directory /path/to/MyApp> Options +ExecCGI </Directory> # Tell Apache this is a FastCGI application <Files myapp_fastcgi.pl> SetHandler fastcgi-script </Files> </VirtualHost> Then a request for /script/myapp_fastcgi.pl will run the application. For more information on using FastCGI under Apache, visit <http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html> Authorization header with mod_fastcgi or mod_cgi By default, mod_fastcgi/mod_cgi do not pass along the Authorization header, so modules like "Catalyst::Plugin::Authentication::Credential::HTTP" will not work. To enable pass-through of this header, add the following mod_rewrite directives: RewriteCond %{HTTP:Authorization} ^(.+) RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT] 2. Configure your application # Serve static content directly DocumentRoot /var/www/MyApp/root Alias /static /var/www/MyApp/root/static FastCgiServer /var/www/MyApp/script/myapp_fastcgi.pl -processes 3 Alias /myapp/ /var/www/MyApp/script/myapp_fastcgi.pl/ # Or, run at the root Alias / /var/www/MyApp/script/myapp_fastcgi.pl/ The above commands will launch 3 app processes and make the app available at /myapp/ Standalone server mode While not as easy as the previous method, running your app as an external server gives you much more flexibility. First, launch your app as a standalone server listening on a socket. script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5 -p /tmp/myapp.pid -d You can also listen on a TCP port if your web server is not on the same machine. script/myapp_fastcgi.pl -l :8080 -n 5 -p /tmp/myapp.pid -d You will probably want to write an init script to handle starting/stopping of the app using the pid file. Now, we simply configure Apache to connect to the running server. # 502 is a Bad Gateway error, and will occur if the backend server is down # This allows us to display a friendly static page that says "down for # maintenance" Alias /_errors /var/www/MyApp/root/error-pages ErrorDocument 502 /_errors/502.html FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket Alias /myapp/ /tmp/myapp.fcgi/ # Or, run at the root Alias / /tmp/myapp.fcgi/ More Info Catalyst::Manual::Deployment::FastCGI. AUTHORS
Catalyst Contributors, see Catalyst.pm COPYRIGHT
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-20 Catalyst::Manual::Deployment::Apache::FastCGI(3pm)
All times are GMT -4. The time now is 09:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy