I have created a shell file to extract an archive from .7z. The shell works fine in the terminal but in the cronjob I get an error.
The command is:
7z x /path/to/file.7z -aoa
The error I receive is:
/path/to/script.sh: line 2: 7z: command not found
I am using the full path to the .7z file and I checked my permissions so I am breaking my head to find out what I am doing wrong.
I changed my script to
#!/bin/bash
/usr/local/bin/7z x /path/to/file.7z -aoa
I now get
/bin/sh: /path/to/script.sh: Permission denied
I have checked the script, file and 7z files and all permissions are set to read/write
OK.. So I fixed the permission issue by using chmod +x on the script.