Sponsored Content
Top Forums Shell Programming and Scripting Need assistance to define path on a script which cron will execute Post 303017871 by jaapar on Wednesday 23rd of May 2018 02:07:01 PM
Old 05-23-2018
Quote:
Originally Posted by jaapar
Yeah? So how do I get the cron to also use my environment when running using command line as opposed to when it runs in cron.
I found the fix, what I did was execute the user's bash_profile in the script or in cron for e.g.

Code:
0 10,22 * * * . $HOME/.bash_profile && /root/auto/generate_rpt.bash.

above fixed it for me.

Thanks.

Last edited by rbatte1; 05-24-2018 at 01:40 PM..
This User Gave Thanks to jaapar For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script execute by cron problem, but manual ok

Hi; I'm facing the problem with my script like below 30 0 * * * /data/SCRIPT/LOADLOGS/loadata1.sh 2 1 >> /tmp/loaddata.txt loadata1.sh calling a another 2 scripts which we need to exe in sequence. when it perform by cron jon, sometimes it just can process 20 recs or less or nothing but... (6 Replies)
Discussion started by: izai
6 Replies

2. UNIX for Dummies Questions & Answers

a cron job needs a perl script to execute

Hello evreyone, this is my first post, and to say i'm new to this is an understatement. I know very little about perl scripts and hope some one can help me. i'm looking to get a script that a cron job can execute. what the script needs to to is 1) connect to a mysql database 2) go to a... (2 Replies)
Discussion started by: Exader
2 Replies

3. Shell Programming and Scripting

cron does not execute script properly

I have a simple script that checks for certain printers and records them to a file. When I run the script manually at the command prompt, it works perfect, but when I run the script via cron, nothing happens. No errors reported, and no records are written out. I'm using Solaris 10. Below is the... (4 Replies)
Discussion started by: lmatlebyane
4 Replies

4. Shell Programming and Scripting

How do I define a particular dir in PATH variable and then unset that dir

How do I define a particular dir in front of PATH variable and then run some job and then at the end of job SET the PATH variable to original? in a script, WILL something like this work: ORIG_PATH=$PATH export PATH=/dir1/dir2:$PATH RUN SOME JOBS ..... unset PATH EXPORT... (2 Replies)
Discussion started by: Hangman2
2 Replies

5. UNIX for Dummies Questions & Answers

cron used to execute multiple commands

have to run multiple commands at a specified time by the user... (3 Replies)
Discussion started by: hemaa
3 Replies

6. Shell Programming and Scripting

Need to execute a command on a path with a space in it...

Hello, I need to execute the following command in a script: /usr/bin/ssh 205.21.1.1 vmware-cmd -v /home/virtual machines//Machine.vmx"createsnapshot Weekly_Backup >/dev/null 2>&1 The problem is that there is a space between virtual and machines and when I run the script I get no such... (2 Replies)
Discussion started by: mojoman
2 Replies

7. Solaris

anomalous behaviour when I execute the script via cron

Hi , I am having a strange problem with my cron job : here is the script that I am scheduling from cron WrapperScript.ksh #!/bin/ksh ########## Global Variables ########## DATE=$(date +"%b-%d-%y") TIME=$(date +"%H:%M") LOGFILE=sonar_execution_$DATE.log ########## Main Processing... (2 Replies)
Discussion started by: alookachaloo
2 Replies

8. Shell Programming and Scripting

Difference between using shell or cron to execute a script

Hi! Maybe i am here in the wrong section for the problem, but let me try to explain. I have the following simple backup script, as a solution till the final backup solution is online. Unfortunatly it will only work when executed manually. When i set up a cron job to execute the script, only the... (4 Replies)
Discussion started by: locutus01
4 Replies

9. UNIX for Dummies Questions & Answers

Highlight directories in path with execute permission for others

Hi all, I'm trying to make a script that takes at the most one argument and lists all directories in the path in a special format: User Group Other Filename rwx r-- r-x \ rwx r-x r-- home This is my code as it is... (1 Reply)
Discussion started by: Trinimini
1 Replies

10. Solaris

cannot execute sqlplus in shell script under cron

Hi, I have a bourne shell script that needs to login into sqlplus and execute a stored procedure. I need this shell script to be run under a user crontab. It works fine if run under normal shell prompt. But it gave error message in my log file when run under crontab: SQL*Plus: Release... (4 Replies)
Discussion started by: joe_x
4 Replies
apticron(1)						      General Commands Manual						       apticron(1)

NAME
apticron - Generate a mail listing packages which are pending an upgrade SYNOPSIS
apticron [--cron] DESCRIPTION
apticron is a shell script which generates a mail with a list of all packages currently pending an upgrade, as well as summary of changes - using apt-listchanges - to a configurable Email address. apticron is mainly intended for automatic notification of pending security updates but can also be used in many other situations where timely updates are necessary. The --cron option is only meant to be used when invoked by cron in order to run no more than once a day. FILES
/etc/apticron/apticron.conf Configuration file, Email address to mail and profile for use with apt-listchanges are configurable. /etc/cron.d/apticron Cron job for executing apticron daily. /etc/cron.daily/apticron Fallback cron script for executing apticron (if no crond running or system down at designated time). /var/lib/misc/apticron.cron Time stamp file used by apticron when invoked with --cron option. SEE ALSO
apt-get(8), apt-listchanges(1), cron(8) AUTHOR
Apticron was initially developed by Colm MacCarthaigh <colm.maccarthaigh@heanet.ie> with contributions from Marc Sherman <msherman@projec- tile.ca>. Since 2006 it is maintained and improved by Tiago Bortoletto Vaz <tiago@debian.org>. apticron(1)
All times are GMT -4. The time now is 04:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy