Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
below command for cron job is not working
20 18 * * * wget -O /dev/null 2>&1 http://www.rolsonscommercial.com/cronjobs/sms/autosms.php.
Please help.
Try giving an absolute path to wget (/usr/local/bin/wget on my system). You can use
$type wget
$which wget
$whereis wget
to figure this out
Also answer, what operating system? what version of cron? Is this a user crontab or system crontab - they have different formats.
Also, when do you want the cron job to run? "not working" is useless information. Answer "what do you expect?", "what is happening", "what are you doing?"
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 months ago.
Improve this question
I am trying to create a temporary directory using mktemp -d but it is not creating a directory. When I try to run cd $(mktemp -d) it takes me to my home folder. This behavior is similar to cd .
When I try to run mktemp -d and check the exit code using echo $? it return 248 as the exit code.
What is going on?
Most likely $(TMPDIR) is set to a non-existent directory or one to which your user lacks write+execute permissions.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
My understanding is that all commands in linux must exist on the $PATH, even for the most basic commands
> which cd
/bin/cd
> which ls
/bin/ls
But when I tried which pushd, to my surprise, it returned:
/usr/bin/which: no pushd in (/bin:/usr/share/maven/bin:/usr/share/java/jdk1.8.0_131/bin:/usr/local/bin:/usr/bin:/usr/local/sbin)
pushd is "installed" and working. This challenges my whole understanding of linux commands.
Can someone explain why this is happening?
Can someone explain why this is happening?
pushd, like many other commands, is a builtin. which is itself an executable and which searches for executables - there is no such executable as pushd.
To affect the current working directory of the shell itself, it has to be a builtin, just like cd.
You can check what it is with type:
$ type pushd
pushd is a shell builtin
what are other examples of such shell builtins?
They are listed in documentation: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Builtin-Commands .
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I am working on some kind of version control for a specific software (Bash script.)
When a new version releases, the code should be updated to the latest release, I have figured this out but I seem stuck and can't make the replacement inline.
#First we download the source code with wget, it returns a text with the new code
wget www.example.com/sourcecode | cat . > $0
How can I redirect that output (text / script) to the current script who's executing it and replace it.
Note $0 gives us the location of the current script. So the cat command, just should replace the new text coming from wget to the current script.
Thanks!
Your question is a bit confused, so I can try to guess your needs.
Are you asking how to capture the output of the commmand you posted?
If yes, the solution is:
source_file_content=$(wget -O - http://www.example.com/sourcecode)
# Do anything with ${source_file_content}
Let me know if it is right for you.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new to Linux commands. I have a requirement where I want to start Tomcat using a shell script. The location of startup.sh file is in /usr/lib/apache-tomcat-7.0.14/bin/. Tomcat is starting using command sh startup.sh. I want to create a shell script so that it will go to that folder and will execute sh startup.sh command. How can I do this using a shell script? Can anyone share the script for doing this?
Are you serious?
#!/bin/bash
cd /usr/lib/apache-tomcat-7.0.14/bin/
sh startup.sh
#!/bin/bash
exec /usr/lib/apache-tomcat-7.0.14/bin/startup.sh
is simpler (as does not have a shell kicking around)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Ok, so I'm trying to set cron to run a bash script at a certain time. My bash script is essentially this
#!/bin/bash
espeak -g 3 "this is my text"
So from there, I went to the crontabs, and added in
*/1 * * * * /path/to/my/script.sh
to see if it would run, but it didn't do anything. I changed the script to
#!/bin/bash
echo "this is my script"
to see if that would do anything, but no avail. Any help? Thanks.
Try to run the script manually and see if it echos out: bash /path/to/my/script.sh
Does the file have the correct permissions?
Try Outputting errors to a log file: */1 * * * * /path/to/my/script.sh > /path/to/my/error.log 2>&1