I set cron job on the Linode server.
my run.sh file in the root directory.
echo $(../uploads + /usr/bin/date +"%Y-%m-%d_%H%M")_name.csv
when I run sh run.sh
my scrapy folder is in root/my_project and upload data into root/uploads
i debugging error using eco
getting error
/root/uploads: Permission denied
_Mobile_Nshopping.csv
I have to use
echo ../uploads/$(/usr/bin/date +"%Y-%m-%d_%H%M")_name.csv instead of under bracket.
Related
i tried to execute an easy shell skript with curl comand.
#!/usr/bin/env bash
.~/.foo
curl -n ${URL}/submit/foo/netrc
i executed this shell script with sudo rights and got the error message /root/.foo No such file or directory This hidden file .foo has an variable URL. If i executed this script without sudo rights. I got the error forbidden. Where is my mistake ?
I am trying to execute shell script which i have created in tmp folder.
i have granted permission as well to the script using command below.
chmod a+x tmp/test/test.sh
when i run the code i get permission denied error.
[root#server test]# ./test.sh
-bash: ./test.sh: Permission denied
The issue may cause by tmp is noexec, and you can use the sh command to execute the the shell script
sh ./test.sh
Try this workaround:
(. tmp/test/test.sh)
Am trying to send MySQL backup from server1 to server2 for backups storage
My command in shell..
scp myfile user#root:/file destination /
I use ssh-agent for paraphrase key pass..
In crontab normal just link to my shell When I use commands .. bash myshel.sh Is successful send but in crontab no will give Root mail saying Permission denied (publickey,gassapi-with -mic,password)
root /usr/Backup/myshell.sh
I have an issue executing a script from another directory using a full path.
For example, user jnh has the script in its home directory(/home/jnh):
# ls -l
total 4
-rwxr-x--- 1 jnh tstgrp 120 Mar 12 16:39 test.run
Now, when I log in as jnh and go to another directory such as /apps and execute the script using the full path, I got an error message:
# /home/jnh/test.run
touch: cannot touch `test.txt': Permission denied
Any idea? Thank you in advance!
Joie
I think your problem is a permissions problem not a scripting problem. Does user jnh have write permission on the directory /apps? Because you are running the script from /apps it's the working directory, and thats where it is trying to create the file, so the user that is running the script must have permissions to do so.
I am using incron to monitor one of my file in /var/www/html directory.
output of incrontab -l
/var/www/html/test IN_ACCESS /home/intel/test.sh
This job is supposed to create a file in home directory, But when this job got executed (I opened the web address in browser), no file is created, following line is whon shown in /var/log/cron file
Jan 20 10:27:57 localhost incrond[26442]: (root) CMD (/home/intel/test.sh)
This clearly shows that event had occurred.
P.S: If I just run a /home/intel/test.sh in CLI its works fine and creates test file, following is my test.sh file.
#!/bin/bash
touch fm00
Mostly this problem occurs due to script file permission and ownership of script files. The same problem was faced by me. I found that my scrip owner was not a super user e.g. root.
So, you have to set the permission and ownership of your scrip as super user. Find below.
First of all edit your crontab as super user.(in RHEL like below)
[abc#host] crontab -e
and save crontab :wq!
Now set permission for script
[abc#host] chmod +x script.sh
[abc#host] chown root:root script.sh
Now restart your crontab.(in RHEL like below)
[abc#host] /etc/init.d/crond restart