Skip to main content
added 136 characters in body
Source Link
user3901666
  • 293
  • 1
  • 4
  • 13

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?

Below is working if I run the script manually like sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt but it's not working: when i run it through cron.

File_to_Refresh="$(sh /Aug/work/Get_Files.sh $1"$1")"

Cron :

45 08 * * * sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?

Below not working:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh $1)"

Cron :

45 08 * * * sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?

Below is working if I run the script manually like sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt but it's not working when i run it through cron.

File_to_Refresh="$(sh /Aug/work/Get_Files.sh "$1")"

Cron :

45 08 * * * sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt
Not working example
Source Link
user3901666
  • 293
  • 1
  • 4
  • 13

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?

Below not working:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh $1)"

Cron :

45 08 * * * sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?

Below not working:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh $1)"

Cron :

45 08 * * * sh /Aug/Work/main.sh /Aug/Work/Universal_File.txt
Source Link
user3901666
  • 293
  • 1
  • 4
  • 13

Cron entry to pass the value to script

I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below:

File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)"

Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3 different values and on 3 different days.

So, to make the script generic, I want to pass the Universal file to Get_Files.sh from the Cron Entry only.

How Can i achieve the same?