07-23-2019
In
ps -f or
ps -o args it is
always
ksh scriptname or
bash scriptname.
In
ps -o fname it is
- bash when started as bash scriptname
- scriptname when started as ./scriptname
Unfortunately some OS have a very small field for the
fname. So it may appear truncated e.g.
scriptname can become
scriptna.
Some OS have
ps -o comm as a wider field and use it like the
fname, some other OS stuff the pathname into it.
Note: that the default scope is: only processes with a terminal associated,
-e means all processes,
-u user means all processes owned by
user.
Last edited by MadeInGermany; 07-23-2019 at 02:19 PM..
Reason: fixed a typo
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I'm writing a script and I've put #!/bin/bash as the first line so that I can just type my scripts name 'whodate' at PS1 instead of ./whodate. This has suddenly stopped working for me. It used to be the case that I could start a script with #!/bin/bash and it would work, but for this script... (2 Replies)
Discussion started by: zorrokan
2 Replies
2. Shell Programming and Scripting
Is it possible with a bash variable to perform multiple substitution strings to one variable?
I have this variable:
echo $clock
TIMEZONE="US/Central"
What I would like to do with bash only it pull out just the "US" part of the variable.. which could be any number of countries.
this is... (6 Replies)
Discussion started by: trey85stang
6 Replies
3. Shell Programming and Scripting
i am having a weird error on mac os x running some shell scripts. i am a complete newbie at this and this question concerns 2 scripts. one of which a friend of mine wrote (videochecker.sh) a couple weeks ago and it's been running fine on another machine.
then last week i wrote capture.sh and it... (2 Replies)
Discussion started by: danpaluska
2 Replies
4. Shell Programming and Scripting
#!/bin/ksh
echo -en "\033|||'-'))
echo -e "\033
The above script works fine when the interpreter is ksh, but outputs the following error when #!/bin/bash is used as shebang:
test.sh: line 5: syntax error near unexpected token `('
test.sh: line 5: `case "$ACTIVATION_KEY" in +(|||'-'))' (2 Replies)
Discussion started by: proactiveaditya
2 Replies
5. Shell Programming and Scripting
THANKS UNIX SYSTEM®.I was found my job from UNIX®.I USE MONKEY WRENCH WITH WARTER.I am now studying my studio with UNIX SYSTEM®.
THANKS UNIX SYSTEM®.
THANKS OUR OPEN GROUP.
from Takayasu Sakashita.My name is Takayasu Sakashita.
I respect you.
Austin.PEACE!Bey bey.
Your friend TAKA.Good... (1 Reply)
Discussion started by: administrator®
1 Replies
6. Shell Programming and Scripting
I need decimal comparing with if. Check if apache version is less than 2.2.17.
I tried this and not working.
#!/bin/bash
apachever=`/usr/local/apache/bin/httpd -v | head -1 | awk '{print $3}' |cut -d/ -f 2`
if ]; then
echo "Apache version less than 2.2.17"
else
... (7 Replies)
Discussion started by: anil510
7 Replies
7. Shell Programming and Scripting
Some question about the usage of shell scripts:
1.) Are the commands of the base shell scripts a subset of bash commands?
2.) Assume I got a long, long script WITHOUT the first line.
How can I find out if the script was originally designed für "sh" or "bash"?
3.) How can I check a given... (3 Replies)
Discussion started by: pstein
3 Replies
8. Shell Programming and Scripting
Hello,
I am showing the start of my script.
I am finding that 'xmessage' is taking about 12-15 seconds to show.
This in a terminal is very quick '/opt/vc/bin/vcgencmd get_camera'.
Is there any way to get 'camera not detected' to show faster.
Regards
#!/bin/bash
s=$(/opt/vc/bin/vcgencmd... (4 Replies)
Discussion started by: mad-hatter
4 Replies
9. Shell Programming and Scripting
So I'm trying to pass certain json elements as env vars and use them later on in a script.
Sample json:
JSON='{
"Element1": "file-123456",
"Element2": "Name, of, company written in, a very weird way",
"Element3": "path/to/some/file.txt",
}'
(part of the) script:
for s... (5 Replies)
Discussion started by: da1
5 Replies
10. Shell Programming and Scripting
I'm new to utilities like socat and netcat and I'm not clear if they will do what I need.
I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes.
I'm using Cygwin bash on Windows 10.
My... (3 Replies)
Discussion started by: siegfried
3 Replies
LEARN ABOUT DEBIAN
plack::handler::fcgi
Plack::Handler::FCGI(3pm) User Contributed Perl Documentation Plack::Handler::FCGI(3pm)
NAME
Plack::Handler::FCGI - FastCGI handler for Plack
SYNOPSIS
# Run as a standalone daemon
plackup -s FCGI --listen /tmp/fcgi.sock --daemonize --nproc 10
# Run from your web server like mod_fastcgi
#!/usr/bin/env plackup -s FCGI
my $app = sub { ... };
# Roll your own
my $server = Plack::Handler::FCGI->new(
nproc => $num_proc,
listen => [ $port_or_socket ],
detach => 1,
);
$server->run($app);
DESCRIPTION
This is a handler module to run any PSGI application as a standalone FastCGI daemon or a .fcgi script.
OPTIONS
listen
listen => [ '/path/to/socket' ]
listen => [ ':8080' ]
Listen on a socket path, hostname:port, or :port.
port
listen via TCP on port on all interfaces (Same as "listen => ":$port"")
leave-umask
Set to 1 to disable setting umask to 0 for socket open
nointr
Do not allow the listener to be interrupted by Ctrl+C
nproc
Specify a number of processes for FCGI::ProcManager
pid Specify a filename for the pid file
manager
Specify a FCGI::ProcManager sub-class
daemonize
Daemonize the process.
proc-title
Specify process title
keep-stderr
Send STDERR to STDOUT instead of the webserver
backlog
Maximum length of the queue of pending connections
WEB SERVER CONFIGURATIONS
In all cases, you will want to install FCGI and FGCI::ProcManager. You may find it most convenient to simply install Task::Plack which
includes both of these.
nginx
This is an example nginx configuration to run your FCGI daemon on a Unix domain socket and run it at the server's root URL (/).
http {
server {
listen 3001;
location / {
set $script "";
set $path_info $uri;
fastcgi_pass unix:/tmp/fastcgi.sock;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
}
}
If you want to host your application in a non-root path, then you should mangle this configuration to set the path to "SCRIPT_NAME" and the
rest of the path in "PATH_INFO".
See <http://wiki.nginx.org/NginxFcgiExample> for more details.
Apache mod_fastcgi
After installing "mod_fastcgi", you should add the "FastCgiExternalServer" directive to your Apache config:
FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/fcgi.sock
## Then set up the location that you want to be handled by fastcgi:
# EITHER from a given path
Alias /myapp/ /tmp/myapp.fcgi/
# OR at the root
Alias / /tmp/myapp.fcgi/
Now you can use plackup to listen to the socket that you've just configured in Apache.
$ plackup -s FCGI --listen /tmp/myapp.sock psgi/myapp.psgi
The above describes the "standalone" method, which is usually appropriate. There are other methods, described in more detail at
"Standalone_server_mode" in Catalyst::Engine::FastCGI (with regards to Catalyst, but which may be set up similarly for Plack).
See also <http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer> for more details.
lighttpd
To host the app in the root path, you're recommended to use lighttpd 1.4.23 or newer with "fix-root-scriptname" flag like below.
fastcgi.server = ( "/" =>
((
"socket" => "/tmp/fcgi.sock",
"check-local" => "disable",
"fix-root-scriptname" => "enable",
))
If you use lighttpd older than 1.4.22 where you don't have "fix-root-scriptname", mouting apps under the root causes wrong "SCRIPT_NAME"
and "PATH_INFO" set. Also, mouting under the empty root ("") or a path that has a trailing slash would still cause weird values set even
with "fix-root-scriptname". In such cases you can use Plack::Middleware::LighttpdScriptNameFix to fix it.
To mount in the non-root path over TCP:
fastcgi.server = ( "/foo" =>
((
"host" = "127.0.0.1",
"port" = "5000",
"check-local" => "disable",
))
It's recommended that your mount path does NOT have the trailing slash. If you really need to have one, you should consider using
Plack::Middleware::LighttpdScriptNameFix to fix the wrong PATH_INFO values set by lighttpd.
SEE ALSO
Plack
perl v5.14.2 2012-06-21 Plack::Handler::FCGI(3pm)