06-05-2006
echo Scriptname
I have several crontab scripts running which email me status. Some of these scripts perform identical tasks so I get a similar emails sent to myself.
How do I get the script to print it's own path/filename so I can include it in the status updates without hardcoding trhe filename into the script?
Any help is appreciated.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi everyone,
I'm very new, I just wrote a script "Hello World" :) LOL
How can I execute the script without the ./myscript.
I want to just type "myscript" basically from anywhere without the " ./ ".
Thanks a bunch,
NinjaX (2 Replies)
Discussion started by: NinjaXman
2 Replies
2. Solaris
I have simply downloaded a file to my local folder, made one small change and uploaded it back, ever since it will not run the file.
I have now uploaded the original, unchanged file, which still doesn;t work.
Evertime it is run ot says bash: ./nrcardprint: No such file or directory
The... (10 Replies)
Discussion started by: Heidi.Ebbs
10 Replies
3. Shell Programming and Scripting
I have started to write Korn scripts on the client's AIX 4.2 servers and there is this small problem that puzzles me.
I code all my scripts the same way:
- first line contains :
#!/bin/ksh
- I do this console command on every scripts:
chmod +x scriptname
But still, on some occasions,... (4 Replies)
Discussion started by: Browser_ice
4 Replies
4. Shell Programming and Scripting
So in my shell i execute:
{ while true; do echo string; sleep 1; done } | read line This waits one second and returns.
But
{ while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly.
I have tried this in bash as well as zsh,... (2 Replies)
Discussion started by: ulidtko
2 Replies
5. UNIX for Dummies Questions & Answers
Bit of a weird one i suppose, i want to use an echo inside an echo... For example...
i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos...
echo "echo "hello"" >$file
echo "echo "goodbye"" >$file
... (3 Replies)
Discussion started by: mokachoka
3 Replies
6. Shell Programming and Scripting
echo `echo ` doesn't echoes anything. And it's logic. But
echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo"
(too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies
7. Shell Programming and Scripting
I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here.
I have following script (called out_to_streams.csh):
#!/bin/tcsh -f
echo Redirected to STDOUT > /dev/stdout
echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies
8. Solaris
Hi,
I am using solaris 10.Is there any way to execute the script with the scriptname wihtoug using ./scriptname?Also does it varies from shell to shell.I have scripts in bash,ksh,sh shells.
Example:script.sh is the script name.I need to execute the script like this script.sh instead... (4 Replies)
Discussion started by: muraliinfy04
4 Replies
9. Shell Programming and Scripting
Hi
I was wondering if there was any command with autorep that can be used to check what the jobname is by givin scriptname that is defined in the JIL of the job (1 Reply)
Discussion started by: sidnow
1 Replies
10. Shell Programming and Scripting
Shell : Linux Bash
OS version : RHEL 6.X, Oracle Linux 6.X
Question1. To execute shell scripts, sometimes I see Linux admins placing sh command before shell scripts like below
sh /home/appadmin/sync_pending_orders.shBut, I execute shell scripts like below ie. Just the absolute path
... (4 Replies)
Discussion started by: John K
4 Replies
LEARN ABOUT MOJAVE
service
SERVICE(8) System Manager's Manual SERVICE(8)
NAME
service - run a System V init script
SYNOPSIS
service SCRIPT COMMAND [OPTIONS]
service --status-all
service --help | -h | --version
DESCRIPTION
service runs a System V init script or systemd unit in as predictable an environment as possible, removing most environment variables and
with the current working directory set to /.
The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT, or the name of a systemd unit. The existence of a
systemd unit of the same name as a script in /etc/init.d will cause the unit to take precedence over the init.d script. The supported val-
ues of COMMAND depend on the invoked script. service passes COMMAND and OPTIONS to the init script unmodified. For systemd units, start,
stop, status, and reload are passed through to their systemctl/initctl equivalents.
All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice,
first with the stop command, then with the start command.
service --status-all runs all init scripts, in alphabetical order, with the status command. The status is [ + ] for running services, [ - ]
for stopped services and [ ? ] for services without a status command. This option only calls status for sysvinit jobs.
EXIT CODES
service calls the init script and returns the status returned by it.
FILES
/etc/init.d
The directory containing System V init scripts.
/{lib,run,etc}/systemd/system
The directories containing systemd units.
ENVIRONMENT
LANG, LANGUAGE, LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEA-
SUREMENT, LC_IDENTIFICATION, LC_ALL, TERM, PATH
The only environment variables passed to the init scripts.
SEE ALSO
/etc/init.d/skeleton
update-rc.d(8)
init(8)
invoke-rc.d(8)
systemctl(1)
AUTHOR
Miloslav Trmac <mitr@redhat.com>, Petter Reinholdtsen <pere@hungry.com>
Licence: GNU Public Licence v2 (GPLv2)
COPYRIGHT
2006 Red Hat, Inc., Petter Reinholdtsen <pere@hungry.com>
Jan 206 SERVICE(8)