Hi forum members,
My first post to the forum, I need your assistance please , I’m stuck with this script permission issue.
*I’ve installed Truenas 13.0-U6.2 on an i7 PC with 16GB RAM, 256GB SSD boot drive and 2 x 4TB drives for data storage.
*Connected via USB a Socomec Netys PE 650Va UPS.
- TN13.0-U16.2 is able to communicate with the UPS using the blazer_usb or the nutdrv_qx drivers.
And I noticed that the first time I test the nut server function, after booting up TN13.0-U6.2, and pulling the plug, the shutdown sequence works well, shutdown is completed according to the values I’ve entered in the Services > UPS settings on the Web GUI and I receive an email to that effect.
Checking the nut service status when it is working properly, see below:
"root@ISFS01[/usr/local/etc/rc.d]# upsc socomec
battery.charge: 100
battery.voltage: 13.70
battery.voltage.high: 13.00
battery.voltage.low: 10.40
battery.voltage.nominal: 12.0
device.type: ups
driver.name: blazer_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 5161
driver.parameter.synchronous: yes
driver.parameter.vendorid: 0665
driver.version: 2.7.4
driver.version.internal: 0.12
input.current.nominal: 2.0
input.frequency: 50.1
input.frequency.nominal: 50
input.voltage: 237.0
input.voltage.fault: 239.1
input.voltage.nominal: 230
output.voltage: 237.0
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 5
ups.productid: 5161
ups.status: OL
ups.temperature: 25.0
ups.type: offline/ line interactive
ups.vendorid: 0665"
So the problem I’m having:
After a little while, within about 5mins of boot, the nut server becomes disconnected from the UPS, see below:
" truenas.local uspmon 1347 - - Poll UPS [socomec@localhost:3493] failed - Driver not connected "
and also the output of the ‘uspc socomec’ query now returns
"Error: Driver not connected"
When I restart the nut server using
“service nut restart”
the nut service is restarted and works fine, but will drop out again after a little while.
Thanks to pointers from member’s feedback in this posting:
https://www.truenas.com/community/threads/problems-with-eaton-e-series-ups.17192/#post-137620
I tried the 2 scripts below:
#!/bin/bash
if [[ $(/usr/local/bin/upsc socomec | grep 'ups.status') == *OL ]];then
exit 0
else
/usr/local/libexec/nut/blazer_usb -a socomec
fi
#!/bin/bash
if [[ $(/usr/local/bin/upsc socomec | grep 'ups.status') == *OL ]];then
exit 0
else
/usr/local/etc/rc.d/nut restart
fi
I’ve saved the script to /mnt/stor/scripts/ups_check.sh, below:
and the Cron job is set to run the command from that /mnt/stor/scripts directory, below:
Testing these commands, from the script above, directly from the shell they work fine, see 3 relevant commands below:
However, when attempting to run it as a cron job, I am getting a permission denied email, I’ve tried all the built-in users but they are not working.
Email msg below:
/bin/sh: /mnt/stor/.system/scripts/ups_check.sh: Permission denied
What am I missing?