logo
down
shadow

bash script not running as expected from cron vs. shell.


bash script not running as expected from cron vs. shell.

By : user2951274
Date : November 18 2020, 01:01 AM
around this issue Your test from the command line is not valid, because you are basically executing the process id, which will give you a command not found.
From the command line you will need to test this way:
code :
$ pidof perl | wc -l
$ which pidof


Share : facebook icon twitter icon
bash script runs from shell but not from cron job

bash script runs from shell but not from cron job


By : KADE
Date : March 29 2020, 07:55 AM
it should still fix some issue If there are no files in the directory, then the wildcard will not be expanded and will be passed to the command directly. There is no file called "*", and then the command fails with "File or directory not found." Try this instead:
code :
if [ -f /home/user/Maildir/.SPAM/cur/* ]; then
    rm /home/user/Maildir/.SPAM/cur/*
fi
find /home/user/Maildir/.SPAM/cur -type f -exec rm '{}' +
find /home/user/Maildir/.SPAM/cur -type f | xargs rm
Cron job: if/else conditions does not work as expected, if shell script is run from Cron job

Cron job: if/else conditions does not work as expected, if shell script is run from Cron job


By : user3921965
Date : March 29 2020, 07:55 AM
it should still fix some issue You can try to remove extension for kitchen.sh file and also add full path to sh :
code :
/bin/sh $PENTAHO_HOME/kitchen -file $ETL_JOB_HOME/sync_job.kjb >> $JOB_LOG_FILE_PATH/$JOB_LOG_FILE_NAME
google spreadsheet reading script in python not running from cron schedule but working when i am running it shell comman

google spreadsheet reading script in python not running from cron schedule but working when i am running it shell comman


By : sjR10
Date : March 29 2020, 07:55 AM
This might help you After getting the suggestion from @stovfl i added >> /tmp/cron.log 2>&1 this line
code :
/home/ubuntu/.virtualenvs/python_3.5/bin/python /location/script_name.py  >> /tmp/cron.log 2>&1
credentials = ServiceAccountCredentials.from_json_keyfile_name('file_name.json')
credentials = ServiceAccountCredentials.from_json_keyfile_name('location_of_file/file_name.json')
I am running a korn script (ksh) on a Cent Os 7 bash shell. The "getopts" is not working as expected. What am

I am running a korn script (ksh) on a Cent Os 7 bash shell. The "getopts" is not working as expected. What am


By : user3495269
Date : March 29 2020, 07:55 AM
this will help Just to help anyone who is looking for an answer:
The answer that worked is the comment by Aaron:
How to check and kill cron job if particular cron running using shell script

How to check and kill cron job if particular cron running using shell script


By : DarkFurious
Date : March 29 2020, 07:55 AM
I wish did fix the issue. If I understand you right, you want to prevent cron overruns. Check out hatools, which addresses exactly that issue.
Related Posts Related Posts :
  • Matlab VideoReader codec error?
  • How to catch the L3-cache hits and misses by perf tool in Linux
  • Executable Deleting Itself on linux
  • How to change the apache httpd port for serving files
  • Installing Patches in linux
  • Comparative analysis between libkvm on linux and NetBSD
  • How to join multiple txt files into based on column?
  • setting LINK variable in Makefile generated by qmake (5.0)
  • Automake - difficulty with installing version 'automake-1.14.1'
  • How to use Linux Network Namespaces for per processes routing?
  • How can I write a Gruntfile with different shell command behaviour for OS X vs. Linux?
  • Using at command in shell script for scheduling a command
  • Is there a method to figure out the audio channel layout in Linux?
  • Setting environment varilable for daemon / root process
  • string replacement in shell script
  • Add specific column to the end of a CSV file
  • Are there programmable automount/autofs hooks in linux/systemd?
  • Renaming files like 20141207_190822.jpg to "2014-12-07 19.08.22.jpg" in linux or MacOS X
  • undocumented kernel boot parameter?
  • using wget to mirror a website with path and subfolder that have the same name
  • Using awk to find data matching date range in text file
  • Installing xorg-x11-devel package in SLES 11 SP2
  • Setting result of find to variable, which has variables within it
  • Maximum/Minimum physical address - Linux kernel
  • Freepbx custom context outbound route
  • memcpy implementation in linux kernel
  • How to reverse a list of words in a shell string?
  • Concatenate and pass as parameter in bash
  • Add user to Docker container
  • How to add a content in a file in linux without opening the file using vi or cat command
  • Which SVN subversion can I use on linux, Mac, Windows?
  • Work with ZIP archive at Bash
  • Compare one field, Remove duplicate if value of another field is greater
  • sudoers NOPASSWD: sudo: no tty present and no askpass program specified
  • How do I use pipes and variable substitution in a shell script (for toggling haproxy active server)?
  • Linux/Unix Find Command
  • Not able to copy data in hdfs with hdfs dfs commands
  • Linux : Remove/Delete .txt files ending with exactly five digits
  • ARM assembly "retne" instruction
  • Migrate from LXC to LXD
  • sbt on linux not accepting -jvm-debug 5005
  • Supervisord events only sent to one eventlistener in pool
  • Finding all .c files in linux using grep
  • Extract part of a file name in bash
  • Bash Script to Comment/uncomment lines in file
  • Linux audio control web alsamixer
  • Can't remove first two encode characters using text editors in linux
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org