Jump to content
Skrumpy

v6.5 unable to run SSH dependent script at array start (SOLVED)

4 posts in this topic Last Reply

Recommended Posts

So did a fresh install (saving nothing except my data and old scripts) from 6.4 to 6.5 the other day. I  copied my SSH folder back over (which contains a key to let me login via sftp without a password) and known hosts, etc. I loaded my old custom crons (into /boot/config/plugins/crontabs) and scripts (into /boot/custom/) and did an update_cron command expecting the scripts to work. Nothing happened. I know the file path and permissions are correct as I can /boot/custom/synctorrents.sh and it functions as expected (no errors and files transfer). This simply will not load for me at startup though. I've tried everything, including adding a cron to the user scripts plugin at array start. One noteable change is that I changed the name of the server (but it has a static IP), unsure if that would have an effect.

 

All permissions are 777 (unless stated in script otherwise) and all scripts done in notepad++ with unix EOL and all paths are correct.

 

Any guidance is appreciated! Thanks!

 

go file (snippet)

./boot/custom/gossh.sh

 

gossh.sh (snippet)

if [ ! -d /root/.ssh ]; then
    mkdir /root/.ssh/
fi

cp /boot/config/ssh/NASKey /root/.ssh/
cp /boot/config/ssh/authorized_keys /root/.ssh/
cp /boot/config/ssh/known_hosts /root/.ssh/
chmod 700 /root/.ssh/
chmod 600 /root/.ssh/NASKey
chmod 600 /root/.ssh/authorized_keys
chmod 600 /root/.ssh/known_hosts

 

sync.cron (snippet)

*/1 * * * * /boot/custom/synctorrents.sh &> /dev/null

 

synctorrents.sh (snippet)

lftp -u "$LOGIN",placeholder -e "set sftp:connect-program 'ssh -a -x -i /root/.ssh/NASKey'" sftp://"$HOST":22<< EOF

 

Section of interest from log (this repeats as I have cron set to every min)

Mar 22 18:28:01 NAS sSMTP[4068]: Authorization failed (535 5.7.8  https://support.google.com/mail/?p=BadCredentials w130sm5362913iod.25 - gsmtp)
Mar 22 18:29:01 NAS crond[1637]: exit status 127 from user root * /boot/custom/synctorrents.sh
Mar 22 18:29:01 NAS sSMTP[4589]: Creating SSL connection to host
Mar 22 18:29:01 NAS sSMTP[4589]: SSL connection using ECDHE-RSA-AES128-GCM-SHA256

nas-syslog-20180322-1836.zip

sync.cron

Edited by Skrumpy

Share this post


Link to post
29 minutes ago, Skrumpy said:

I loaded my old custom crons (into /boot/config/plugins/crontabs) and scripts (into /boot/custom/) and did an update_cron command expecting the scripts to work.

Since ~6.4.1 this will no longer work.  The webUI will not parse .cron files in a folder that does not correspond with an installed plugin.   Toss them into the dynamix folder, or use user.scripts plugin.

32 minutes ago, Skrumpy said:

I've tried everything, including adding a cron to the user scripts plugin at array start.

What happens in user scripts if you run the script manually (foreground) via its UI?

Share this post


Link to post
2 hours ago, Squid said:

Since ~6.4.1 this will no longer work.  The webUI will not parse .cron files in a folder that does not correspond with an installed plugin.   Toss them into the dynamix folder, or use user.scripts plugin.

What happens in user scripts if you run the script manually (foreground) via its UI?

OMFG.. that change was annoying.. I spent a couple of hours trying to figure out what I was doing wrong. I even anticipated that there was some sort of change like that. So I moved the cron file to the plugins/user.scripts and even the /user.scripts/scripts dir and it still didn't work. It is working now (with your suggestion of putting it in the dynamix folder). Is there a specific area where custom user crons are supposed to go (not a huge fan of throwing them in a random and unrelated dir)?

 

2 hours ago, Squid said:

What happens in user scripts if you run the script manually (foreground) via its UI?

Still wasn't working for me.. but it's entirely possible that I had something configured incorrectly as at that point I was pretty exasperated. I'll probably move my scripts to your plug at some point in the future. Is it possible to do a custom run of every 1 min and then just forgo the cron additions?

 

Over the past years, whenever I do a search for Unraid help I always see you responding in seemingly every thread. You are a real boon to the community. Thanks Squid!

Share this post


Link to post
13 hours ago, Skrumpy said:

Is it possible to do a custom run of every 1 min and then just forgo the cron additions?

Default schedules are hourly, daily, weekly, monthly.  But you also have the ability to specify a custom cron schedule.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.