Sponsored Content
Top Forums Shell Programming and Scripting command in Script one to start script2 Post 302072262 by swissman24 on Sunday 30th of April 2006 10:58:32 AM
Old 04-30-2006
command in Script one to start script2

Hello,
Hardly registered and already I am asking another question! Smilie
Following script gets started everyday with a cronjob:
Code:
#!/bin/ksh

#Variablen für das Script
Tag=`date +%d`
Monat=`date +%m`
Vortag=$((Tag-1))
Loeschtag=$((Tag-8))
Dir=/prj/sr_tmp/tpr

#Verzeichniss wechseln damit script von wo auch immer ausgefuert werden kann
cd $Dir

#Dir erstellen, Zippen und die gezippten files in das neue Dir moven
mkdir $Dir/"$Vortag""$Monat"
gzip *_"$Vortag"_*.tpr
mv *.gz $Dir/"$Vortag""$Monat"

#Aeltestes Directory löschen
rm -rf "$Loeschtag"*

#Temporaerer Code fuer Michi und David fuer Inv dateien
TprDave=$Dir/tprdave
mkdir $TprDave/"$Vortag""$Monat"
cp $Dir/"$Vortag""$Monat"/inv* $TprDave/"$Vortag""$Monat"

#Temp Datei erstellen fuer Status report
touch $Dir/tmp.txt
if [ $? -eq 0 ] ; then
echo "Script erfolgreich Ausgefuert" > $Dir/status.txt
else
echo "Script nicht erfolgreich Ausgefuert!  Bitte $tp pruefen." > status.txt
fi
#End of Script

After this script runs through i need to start this script:

Code:
#!/bin/ksh

recipient=`more $tp/email.txt`

echo "*************************************" > mailbody.txt
echo `date` >> mailbody.txt
echo "*************************************" >> mailbody.txt
echo >> mailbody.txt

echo "*************************************" >> mailbody.txt
echo "Tracefile status" >> mailbody.txt
echo "*************************************" >> mailbody.txt

echo `more $tp/status.txt` >> mailbody.txt
echo >> mailbody.txt

echo "*************************************" >> mailbody.txt
echo "Plattenfuellstand" >> mailbody.txt
echo "*************************************" >> mailbody.txt

df -k >> mailbody.txt
echo >> mailbody.txt

echo "*************************************" >> mailbody.txt
echo "Fehlermeldungen" >> mailbody.txt
echo "*************************************" >> mailbody.txt

dia -R >> mailbody.txt
echo "EOF" >> mailbody.txt

mailx -s "Pikettdaten" $recipient < mailbody.txt

rm -f mailbody.txt

I read a bunch of stuff here how to do things with cronjobs but since I am relativly new to scripting here and always learning I could not figure out how to make my scripts work consecutivly.

So once again I would be happy for any help.
And just on the something on the side: I know from vba that there are proper and improper ways to code. Although both might work one is better than the other. How is the coding here?

Thnx and KR
David
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

What is the command to start the cdrom

Hello people, What is the command to start the cdrom from the command prompt on solaris 9? plz help. rs (5 Replies)
Discussion started by: rsh
5 Replies

2. Shell Programming and Scripting

how to start SCRIPT command at begin of TERMINAL?

Hello sir, I want to monitor my work on the terminal.I know we can use script command.But every time when I start the terminal, I have to type script to start it.I want to automate it. So where should I include this command so that it will start as soon as I start the terminal ???? (2 Replies)
Discussion started by: nsharath
2 Replies

3. Web Development

Http -k start Command Not found

I have Apache server installed as a package on my fedora 9 .. when i go to /etc and type the command httpd -k start It says command not found....Can anyone please tell so that i can run that command and start the server ---------- Post updated at 12:03 PM ---------- Previous update... (1 Reply)
Discussion started by: bssandeshbs
1 Replies

4. UNIX for Dummies Questions & Answers

Unix command for a dummy... where do i start?

I have never used Unix before and only heard of it at the start of the week. But ny new job requires me to use the Unix/Linux command, and i need an introduction for a total beginer... are there any intro videos or books you would recomend? :confused: (2 Replies)
Discussion started by: tomvcarter
2 Replies

5. OS X (Apple)

How to start a new terminal from command line?

Dear All, Anyone knows how to start a new bash terminal from command line? Another question: when I use "open" command (open test.pdf) to open a pdf file, the PDF reader will start up, but cannot associate with that file. Anyone knows why? (1 Reply)
Discussion started by: andrewust
1 Replies

6. OS X (Apple)

Can I erase and start my mac with unix command

I made a tragic error and erased the extensions manager from my IMac. Now, I can't get the computer to boot up. It just stays on the gray screen. I've tried using the open apple+s method, which brings up the command console (not sure if I've got the lingo down right), and I've tried everything, but... (12 Replies)
Discussion started by: ccff22290
12 Replies

7. Shell Programming and Scripting

Require single command to start script in multiple servers

I have 9 servers, on each server a script with common name is available. I send a token file to all server from 1 particular server. so when a daemon job checks that token file is available then it triggers the script.. I want to know is there any command or script which I will run/execute on... (16 Replies)
Discussion started by: mirwasim
16 Replies

8. AIX

AIX command to start listener

HI All, Need help on comamnd to start listener TIA. (4 Replies)
Discussion started by: sumanthupar
4 Replies

9. Red Hat

No reponse to 'service NFS start' command

Hello, I have a newly kickstarted RHEL 6.4 server that I'm trying to set-up as a kickstart server. I have done this before on other machines, but I am encountering some strange behaviour in this one. # service nfs status rpc.svcgssd is stopped rpc.mountd is stopped nfsd is stopped... (0 Replies)
Discussion started by: Chopstyx
0 Replies

10. Solaris

How to start gui from Solaris command line?

Hi. I'm a Solaris newbie. I'm using Solaris SunOS Version 11.4.0.15.0 through Oracle VM VirtualBox Manager on Windows. When I start the VM, I get to a command line I can login to. I've tried using: /usr/dt/bin/dtconfig -e However, I receive error "No such file or directory". The... (3 Replies)
Discussion started by: SRD
3 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 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy