how to to put a shell script in crontab in solaris to automate the script [closed]
Clash Royale CLAN TAG#URR8PPP
#!/bin/bash
# Checks rather system is running Linux or Solaris
function osCheck {
os_type=$(uname -i)
echo "Checking OS type."
case $os_type in
"x86_64")
linuxDiskCheck
;;
*)
solarisDiskCheck
;;
done
this is just test script
cron
closed as unclear what you're asking by Rui F Ribeiro, Michael Homer, Mr Shunz, Haxiel, sebasth Feb 28 at 9:09
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
#!/bin/bash
# Checks rather system is running Linux or Solaris
function osCheck {
os_type=$(uname -i)
echo "Checking OS type."
case $os_type in
"x86_64")
linuxDiskCheck
;;
*)
solarisDiskCheck
;;
done
this is just test script
cron
closed as unclear what you're asking by Rui F Ribeiro, Michael Homer, Mr Shunz, Haxiel, sebasth Feb 28 at 9:09
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Welcome to U&L. Have you gone through the documentation for cron on Solaris? Is there a more specific issue you want to address?
– Haxiel
Feb 26 at 13:07
You might want to check the syntax of your script at shellcheck.net It's missing several lines at the bottom, for example.
– roaima
Feb 27 at 18:08
add a comment |
#!/bin/bash
# Checks rather system is running Linux or Solaris
function osCheck {
os_type=$(uname -i)
echo "Checking OS type."
case $os_type in
"x86_64")
linuxDiskCheck
;;
*)
solarisDiskCheck
;;
done
this is just test script
cron
#!/bin/bash
# Checks rather system is running Linux or Solaris
function osCheck {
os_type=$(uname -i)
echo "Checking OS type."
case $os_type in
"x86_64")
linuxDiskCheck
;;
*)
solarisDiskCheck
;;
done
this is just test script
cron
cron
edited Feb 26 at 13:40
Romeo Ninov
6,83432129
6,83432129
asked Feb 26 at 12:40
user4485user4485
11
11
closed as unclear what you're asking by Rui F Ribeiro, Michael Homer, Mr Shunz, Haxiel, sebasth Feb 28 at 9:09
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Rui F Ribeiro, Michael Homer, Mr Shunz, Haxiel, sebasth Feb 28 at 9:09
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Welcome to U&L. Have you gone through the documentation for cron on Solaris? Is there a more specific issue you want to address?
– Haxiel
Feb 26 at 13:07
You might want to check the syntax of your script at shellcheck.net It's missing several lines at the bottom, for example.
– roaima
Feb 27 at 18:08
add a comment |
Welcome to U&L. Have you gone through the documentation for cron on Solaris? Is there a more specific issue you want to address?
– Haxiel
Feb 26 at 13:07
You might want to check the syntax of your script at shellcheck.net It's missing several lines at the bottom, for example.
– roaima
Feb 27 at 18:08
Welcome to U&L. Have you gone through the documentation for cron on Solaris? Is there a more specific issue you want to address?
– Haxiel
Feb 26 at 13:07
Welcome to U&L. Have you gone through the documentation for cron on Solaris? Is there a more specific issue you want to address?
– Haxiel
Feb 26 at 13:07
You might want to check the syntax of your script at shellcheck.net It's missing several lines at the bottom, for example.
– roaima
Feb 27 at 18:08
You might want to check the syntax of your script at shellcheck.net It's missing several lines at the bottom, for example.
– roaima
Feb 27 at 18:08
add a comment |
1 Answer
1
active
oldest
votes
Let suppose your script is located in /path/to/script.sh
. You should make it executable:
chmod 700 /path/to/script.sh
Then executing crontab -e
you get open editor (probably vi
) where you enter
0 2 * * * /path/to/script.sh
This will execute the script once per day at 2h 0 minutes in the night.
If you want to execute it every 4 hours you can enter (Linux)
0 */4 * * * /path/to/script.sh
For Solaris you may need to enter the record on this way:
0 0,4,8,12,16,20 * * * /path/to/script.sh
You may redirect the STDOUT and/or STDERR to file by your choise
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Let suppose your script is located in /path/to/script.sh
. You should make it executable:
chmod 700 /path/to/script.sh
Then executing crontab -e
you get open editor (probably vi
) where you enter
0 2 * * * /path/to/script.sh
This will execute the script once per day at 2h 0 minutes in the night.
If you want to execute it every 4 hours you can enter (Linux)
0 */4 * * * /path/to/script.sh
For Solaris you may need to enter the record on this way:
0 0,4,8,12,16,20 * * * /path/to/script.sh
You may redirect the STDOUT and/or STDERR to file by your choise
add a comment |
Let suppose your script is located in /path/to/script.sh
. You should make it executable:
chmod 700 /path/to/script.sh
Then executing crontab -e
you get open editor (probably vi
) where you enter
0 2 * * * /path/to/script.sh
This will execute the script once per day at 2h 0 minutes in the night.
If you want to execute it every 4 hours you can enter (Linux)
0 */4 * * * /path/to/script.sh
For Solaris you may need to enter the record on this way:
0 0,4,8,12,16,20 * * * /path/to/script.sh
You may redirect the STDOUT and/or STDERR to file by your choise
add a comment |
Let suppose your script is located in /path/to/script.sh
. You should make it executable:
chmod 700 /path/to/script.sh
Then executing crontab -e
you get open editor (probably vi
) where you enter
0 2 * * * /path/to/script.sh
This will execute the script once per day at 2h 0 minutes in the night.
If you want to execute it every 4 hours you can enter (Linux)
0 */4 * * * /path/to/script.sh
For Solaris you may need to enter the record on this way:
0 0,4,8,12,16,20 * * * /path/to/script.sh
You may redirect the STDOUT and/or STDERR to file by your choise
Let suppose your script is located in /path/to/script.sh
. You should make it executable:
chmod 700 /path/to/script.sh
Then executing crontab -e
you get open editor (probably vi
) where you enter
0 2 * * * /path/to/script.sh
This will execute the script once per day at 2h 0 minutes in the night.
If you want to execute it every 4 hours you can enter (Linux)
0 */4 * * * /path/to/script.sh
For Solaris you may need to enter the record on this way:
0 0,4,8,12,16,20 * * * /path/to/script.sh
You may redirect the STDOUT and/or STDERR to file by your choise
answered Feb 26 at 13:46
Romeo NinovRomeo Ninov
6,83432129
6,83432129
add a comment |
add a comment |
Welcome to U&L. Have you gone through the documentation for cron on Solaris? Is there a more specific issue you want to address?
– Haxiel
Feb 26 at 13:07
You might want to check the syntax of your script at shellcheck.net It's missing several lines at the bottom, for example.
– roaima
Feb 27 at 18:08