I have the following crontab entry to run a shell script for every 30 minutes of every day:
30 * * * * $HOME/main.sh > $HOME/main.log 2>$HOME/error.log
after I created the crontab file I have also done:
$crontab my_crontab
I also check to make sure it exists, by using the following... (11 Replies)
Please help - I have seen others ask this question but I need a simple example of using vi in a shell script. Once I enter VI the shell script does not execute the next commands until I q!. I invoke VI and start the edit process. I want to go to the third line and replace a character with a new... (2 Replies)
using sqlplus I want to execute a .sql script that has dbms_output statments in rhe script. I want to write the dbms_output statements from .sql file to a log file. is this possible. thanks
any help would be appreciated
:wall: (1 Reply)
I made a shell script to execute a server in screen mode.
# start server
screen -d -m -S Test ./application
echo "Program Started Successfully"
than I'm executing it from php by
echo shell_exec('/home/script.sh');
and it is giving me this error.
"cannot make directory... (1 Reply)
Hi,
I am looking for a script wherein i will be able to execute below procedures one by one in line and next procedures starts only when the previous one completes and also after execution of each procedure i will be getting a automted mail as "PL/SQL PROCEDURE SUCCESSFULLY EXCETUTED".
... (1 Reply)
Hi,
I am having a shell script which has a while loop as shown below.
while
do
sleep 60
done
I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Hi
As per my requirement when I run . ./file.sh am getting the following error
-bash:ELF: command not found
when i execute as ./file.sh it is getting executed.How to resolve this.
Thanks in advance. (3 Replies)
Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only..
it... (1 Reply)
Hi All,
I came across a weird scenario which i couldnt explain why.
As part of script which is run as /bin/sh shebang, we are trying to check if there is any process that runs with the same name ignoring the current process and kill it.
But for some reason, there are 2 process returned as part... (1 Reply)
I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies
LEARN ABOUT REDHAT
system
SYSTEM(3) Linux Programmer's Manual SYSTEM(3)NAME
system - execute a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *string);
DESCRIPTION
system() executes a command specified in string by calling /bin/sh -c string, and returns after the command has been completed. During
execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.
RETURN VALUE
The value returned is -1 on error (e.g. fork failed), and the return status of the command otherwise. This latter return status is in the
format specified in wait(2). Thus, the exit code of the command will be WEXITSTATUS(status). In case /bin/sh could not be executed, the
exit status will be that of a command that does exit(127).
If the value of string is NULL, system() returns nonzero if the shell is available, and zero if not.
system() does not affect the wait status of any other children.
CONFORMING TO
ANSI C, POSIX.2, BSD 4.3
NOTES
As mentioned, system() ignores SIGINT and SIGQUIT. This may make programs that call it from a loop uninterruptable, unless they take care
themselves to check the exit status of the child. E.g.
while(something) {
int ret = system("foo");
if (WIFSIGNALED(ret) &&
(WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
break;
}
Do not use system() from a program with suid or sgid privileges, because strange values for some environment variables might be used to
subvert system integrity. Use the exec(3) family of functions instead, but not execlp(3) or execvp(3). system() will not, in fact, work
properly from programs with suid or sgid privileges on systems on which /bin/sh is bash version 2, since bash 2 drops privileges on
startup. (Debian uses a modified bash which does not do this when invoked as sh.)
The check for the availability of /bin/sh is not actually performed; it is always assumed to be available. ISO C specifies the check, but
POSIX.2 specifies that the return shall always be non-zero, since a system without the shell is not conforming, and it is this that is
implemented.
It is possible for the shell command to return 127, so that code is not a sure indication that the execve() call failed.
SEE ALSO sh(1), signal(2), wait(2), exec(3)
2001-09-23 SYSTEM(3)