I have completly confused myself on trying to get a script to run and hope someone can set me on the path to enlightenment :)
I have seren's rrd temp graphing script up and running just fine. I am trying to create a script that emails me the graph png file early in the am so I can take a quick look as part of my morning emails to make sure things are ok. If I paste the commands into the shell it runs just fine.
Here is the script:
since it runs in the shell I took it and created the file "mailtemps2.sh" via notepad ++
The file is located in /mnt/Camera/script
If I try and run the script from the shell with the following command "[root@freenas ~]# ./mnt/Camera/script/mailtemp2.sh"
I get this: "bash: ./mnt/Camera/script/mailtemp2.sh: No such file or directory"
If I change into the directory and try to run it "[root@freenas /mnt/Camera/script]# .mailtemp2.sh"
I get this: "bash: .mailtemp2.sh: command not found"
Finally if I try to set it as a cron job I get an email with the subject: "Cron <root@freenas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/Camera/script/mailtemp2.sh > /dev/null"
and the text of the email is "/bin/sh: /mnt/Camera/script/mailtemp2.sh: not found"
I am a complete novice when it comes to scripting but once I see how it works I can usually figure it out.. not this time.. I am stumped. I am sure its something simple, but to me its confusing as hall.. :) any help would be greatly appreciated
I have seren's rrd temp graphing script up and running just fine. I am trying to create a script that emails me the graph png file early in the am so I can take a quick look as part of my morning emails to make sure things are ok. If I paste the commands into the shell it runs just fine.
Here is the script:
Code:
#!/usr/local/bin/bash email="x@x.com" subject="CPU Temps" uuencode /mnt/Camera/script/temps-2min-cpus.png temps-2min-cpus.png > /tmp/out.mail mail -s "${subject}" "${email}" < /tmp/out.mail
since it runs in the shell I took it and created the file "mailtemps2.sh" via notepad ++
The file is located in /mnt/Camera/script
If I try and run the script from the shell with the following command "[root@freenas ~]# ./mnt/Camera/script/mailtemp2.sh"
I get this: "bash: ./mnt/Camera/script/mailtemp2.sh: No such file or directory"
If I change into the directory and try to run it "[root@freenas /mnt/Camera/script]# .mailtemp2.sh"
I get this: "bash: .mailtemp2.sh: command not found"
Finally if I try to set it as a cron job I get an email with the subject: "Cron <root@freenas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/Camera/script/mailtemp2.sh > /dev/null"
and the text of the email is "/bin/sh: /mnt/Camera/script/mailtemp2.sh: not found"
I am a complete novice when it comes to scripting but once I see how it works I can usually figure it out.. not this time.. I am stumped. I am sure its something simple, but to me its confusing as hall.. :) any help would be greatly appreciated