Woodpusherghd Posted November 20, 2016 Share Posted November 20, 2016 After disabling a script I received the following error: Warning: syntax error, unexpected '(' in Unknown on line 11 in /usr/local/emhttp/plugins/user.scripts/helpers.php on line 42 This is on 6.3-rc4. Quote Link to comment
Squid Posted November 20, 2016 Author Share Posted November 20, 2016 After disabling a script I received the following error: Warning: syntax error, unexpected '(' in Unknown on line 11 in /usr/local/emhttp/plugins/user.scripts/helpers.php on line 42 This is on 6.3-rc4. That showed up in the UI? Can you show me the line that you're adding to the script Quote Link to comment
Woodpusherghd Posted November 20, 2016 Share Posted November 20, 2016 This occurred when I disabled Danioj's Autovmbackup script. It had been working fine when enabled to run weekly using the Dynamix Schedules plugin. Quote Link to comment
Squid Posted November 20, 2016 Author Share Posted November 20, 2016 This occurred when I disabled Danioj's Autovmbackup script. It had been working fine when enabled to run weekly using the Dynamix Schedules plugin. Check for updates. (It was danioj's copyright message messing it up - tightened up the parsing on looking for my own variables within the comments) Quote Link to comment
Woodpusherghd Posted November 20, 2016 Share Posted November 20, 2016 Updated, thanks. Quote Link to comment
Pducharme Posted December 4, 2016 Share Posted December 4, 2016 I wonder if a brilliant guy here can do a simple script that does this : 1. Check WAN IP, if it changes from the hour before, run the following command : 2. Restart the ProFTPd plugin I know it's strange, but I found out that even if i'm using a domain name that point to my dynamic IP (and update when it change), the ProFTPd service doesn't work with TLS encryption if it is not restarted on a IP change. Quote Link to comment
Squid Posted December 4, 2016 Author Share Posted December 4, 2016 I wonder if a brilliant guy here can do a simple script that does this : 1. Check WAN IP, if it changes from the hour before, run the following command : 2. Restart the ProFTPd plugin I know it's strange, but I found out that even if i'm using a domain name that point to my dynamic IP (and update when it change), the ProFTPd service doesn't work with TLS encryption if it is not restarted on a IP change. Everything but the actual command to restart ProFTPd. (add the command where indicated) #!/usr/bin/php <?PHP #description=Script to restart a service / bash command when the WAN IP changes function download_url($url, $path = "", $bg = false){ exec("curl --compressed --max-time 60 --silent --insecure --location --fail ".($path ? " -o '$path' " : "")." $url ".($bg ? ">/dev/null 2>&1 &" : "2>/dev/null"), $out, $exit_code ); return ($exit_code === 0 ) ? implode("\n", $out) : false; } @unlink("/tmp/scriptNewIP"); download_url("http://ipecho.net/plain","/tmp/scriptNewIP"); $newIP=@file_get_contents("/tmp/scriptNewIP"); if ( ! $newIP ) { echo "failed to determine new IP\n"; exit(0); } if ( is_file("/tmp/scriptOldIP") ) { $oldIP = @file_get_contents("/tmp/scriptOldIP"); if ( $oldIP != $newIP ) { echo("WAN IP changed. Restarting services\n"); # change within the quotes to whatever you need exec("put the bash command here within the quotes"); } else { echo "WAN IP has not changed\n"; } } file_put_contents("/tmp/scriptOldIP",$newIP); ?> Quote Link to comment
rd_blair Posted December 7, 2016 Share Posted December 7, 2016 Did I find an typo ? Line 43 helpers.php $iniString .= $testString; Quote Link to comment
Squid Posted December 8, 2016 Author Share Posted December 8, 2016 Did I find an typo ? Line 43 helpers.php $iniString .= $testString; nope Quote Link to comment
rd_blair Posted December 8, 2016 Share Posted December 8, 2016 Did I find an typo ? Line 43 helpers.php $iniString .= $testString; nope Squid: Just wondering what does the period do or mean? Thanks Reed Edit I found what it means brain fart!!! Quote Link to comment
kizer Posted December 13, 2016 Share Posted December 13, 2016 I was looking at the Mover code at a specific threshold script, however I was trying to figure out how to move oldest folder from a Disk to another Disk at a specific threshold. I normally move the oldest folder from a specific folder simply to reduce Disk spin ups across my array. Has anybody ever worked on something like that or could you throw me a bone on how to modify what somebody else has already done into something of the sort that I have slapped together? My reasoning is I move "All" my files from my windows machine to: Disk3 then to Disk5 for archiving Disk2 then to Disk4 for archiving Here is what my Slapped together code that works if I manually run it, but I'd like to incorporate Threshold into it: #!/bin/sh OLD="disk3" NEW="disk5" MoveSearch="`ls -t /mnt/$OLD/Movies/All/ | tail -n 1`" echo moving $MoveSearch mv /mnt/$OLD/Movies/All/$MoveSearch /mnt/$NEW/Movies/All/ echo $MoveSearch move complete /usr/local/emhttp/plugins/dynamix/scripts/notify -e "Recovering Space" -d "Moving $MoveSearch from $OLD to $NEW" -i "normal" -m "Moved $MoveSearch from $OLD to $NEW" The OLD and NEW Variable isn't required, but I just decided a while back it was easier for me to just drop it in so I could wash, rinse and repeat without digging in the code often when I wanted to run on multiple disks and reduce the error factor. Maybe someday I'll get fancy with it, but figured if I had a threshold script I could just let it run often and not worry about it. I attempted for simplicity sake to just make a call from the mover script to what I've done, but apparently I messed things up and it just doesn't work. I deleted what I did a while back and just remembered recently and figured why not just ask here. Quote Link to comment
Squid Posted December 13, 2016 Author Share Posted December 13, 2016 I was looking at the Mover code at a specific threshold script, however I was trying to figure out how to move oldest folder from a Disk to another Disk at a specific threshold. I normally move the oldest folder from a specific folder simply to reduce Disk spin ups across my array. Has anybody ever worked on something like that or could you throw me a bone on how to modify what somebody else has already done into something of the sort that I have slapped together? My reasoning is I move "All" my files from my windows machine to: Disk3 then to Disk5 for archiving Disk2 then to Disk4 for archiving Here is what my Slapped together code that works if I manually run it, but I'd like to incorporate Threshold into it: #!/bin/sh OLD="disk3" NEW="disk5" MoveSearch="`ls -t /mnt/$OLD/Movies/All/ | tail -n 1`" echo moving $MoveSearch mv /mnt/$OLD/Movies/All/$MoveSearch /mnt/$NEW/Movies/All/ echo $MoveSearch move complete /usr/local/emhttp/plugins/dynamix/scripts/notify -e "Recovering Space" -d "Moving $MoveSearch from $OLD to $NEW" -i "normal" -m "Moved $MoveSearch from $OLD to $NEW" The OLD and NEW Variable isn't required, but I just decided a while back it was easier for me to just drop it in so I could wash, rinse and repeat without digging in the code often when I wanted to run on multiple disks and reduce the error factor. Maybe someday I'll get fancy with it, but figured if I had a threshold script I could just let it run often and not worry about it. I attempted for simplicity sake to just make a call from the mover script to what I've done, but apparently I messed things up and it just doesn't work. I deleted what I did a while back and just remembered recently and figured why not just ask here. Since I can't stand bash, and have to look up everytime how to do math, variables, etc. what I'm going to suggest is use my threshhold mover script and simply change the two lines that state exec("/usr/local/sbin/mover"); and change it to exec("/boot/KizerScript/myMove.sh"); and change your echo commands to logger instead where /boot/KizerScript/myMove.sh is your script location. Or, alternatively if I think about it in the next week or so I'll pump together a script to move from a source to a destination if the free space on a share is less than X, and to move the files from eldest to newest Quote Link to comment
kizer Posted December 13, 2016 Share Posted December 13, 2016 I'm up for anything. Lol I'd like to keep it simple and effective and if everybody gets a benefit from it even better. I just slap things together and pray they work. Often the results are somewhat questionable, but things seem to get done. lol As for the nofications they aren't really required just something I was tinkering with at the time. Quote Link to comment
CyberMew Posted December 24, 2016 Share Posted December 24, 2016 Is this similar to the dynamix cron where we just put the script we want to run in the config/plugins folder? Is there any sample on how to execute the script after array starts/mounts? Quote Link to comment
Squid Posted December 24, 2016 Author Share Posted December 24, 2016 Is this similar to the dynamix cron where we just put the script we want to run in the config/plugins folder? Is there any sample on how to execute the script after array starts/mounts? Sample scripts come with the plugin. Only thing is that at the moment scripts must be named "script" in their own folder. But it'll take any script using any interpreter you choose. To run it on array start, just set the schedule to be on array start Quote Link to comment
CyberMew Posted December 24, 2016 Share Posted December 24, 2016 Is this similar to the dynamix cron where we just put the script we want to run in the config/plugins folder? Is there any sample on how to execute the script after array starts/mounts? Sample scripts come with the plugin. Only thing is that at the moment scripts must be named "script" in their own folder. But it'll take any script using any interpreter you choose. To run it on array start, just set the schedule to be on array start Thanks I got it to work. I didn't see any sample scripts in the folder by default but that's okay. However my echos are not showing up in the console, is it because it runs > /dev/null 2>&1? If so, how do I change it? Quote Link to comment
thomast_88 Posted January 8, 2017 Share Posted January 8, 2017 Would it be possible to set a custom cron schedule. I want to run a script every 5 minutes rather than every 1 hour (which seems to be the lowest frequency at the moment). Quote Link to comment
trurl Posted January 8, 2017 Share Posted January 8, 2017 Would it be possible to set a custom cron schedule. I want to run a script every 5 minutes rather than every 1 hour (which seems to be the lowest frequency at the moment). See this thread starting here for example. Quote Link to comment
Squid Posted January 8, 2017 Author Share Posted January 8, 2017 Would it be possible to set a custom cron schedule. I want to run a script every 5 minutes rather than every 1 hour (which seems to be the lowest frequency at the moment). It's on the to do list. When I did this originally, I was very surprised at the reception the plugin got, so certain design considerations I made at the time makes it a PITA to implement that. I just gotta find some time. Quote Link to comment
thomast_88 Posted January 8, 2017 Share Posted January 8, 2017 See this thread starting here for example. It's on the to do list. When I did this originally, I was very surprised at the reception the plugin got, so certain design considerations I made at the time makes it a PITA to implement that. I just gotta find some time. Okay cool - i appreciate your work. I can live with 1 hour for now. I'll wait patiently for the support of custom schedules Quote Link to comment
Squid Posted January 12, 2017 Author Share Posted January 12, 2017 I'll wait patiently for the support of custom schedules Testing the code tonight. So release is tonight / tomorrow. But it's a raw cron entry. No dropdowns, etc when set to custom so you have the utmost flexibility. Quote Link to comment
Squid Posted January 13, 2017 Author Share Posted January 13, 2017 - Ability to set schedules to any arbitrary custom cron schedule. If you don't know what cron is, see here: https://en.wikipedia.org/wiki/Cron You can enter in any cron expression for the utmost in flexibility. Only enter in the expression. The command to run will automatically be added. As usual, the same flexibility in scripts apply. Namely, any interpreter is allowed. If no interpreter is specified, /bin/bash is assumed, EOL can be either Linux or Windows style. Quote Link to comment
thomast_88 Posted January 13, 2017 Share Posted January 13, 2017 Testing the code tonight. So release is tonight / tomorrow. But it's a raw cron entry. No dropdowns, etc when set to custom so you have the utmost flexibility. flexibility > user-friendliness - Ability to set schedules to any arbitrary custom cron schedule. If you don't know what cron is, see here: https://en.wikipedia.org/wiki/Cron You can enter in any cron expression for the utmost in flexibility. Only enter in the expression. The command to run will automatically be added. As usual, the same flexibility in scripts apply. Namely, any interpreter is allowed. If no interpreter is specified, /bin/bash is assumed, EOL can be either Linux or Windows style. Crisp ! That was quick! Already changed my first job to run every 5 minutes Quote Link to comment
Squid Posted January 13, 2017 Author Share Posted January 13, 2017 Testing the code tonight. So release is tonight / tomorrow. But it's a raw cron entry. No dropdowns, etc when set to custom so you have the utmost flexibility. flexibility > user-friendliness Damn near impossible to create a GUI that could possibly encompass all of the options that cron has. Quote Link to comment
kizer Posted January 13, 2017 Share Posted January 13, 2017 I think the only thing I would ask for or suggest is a little popup or maybe something that can be explained when you click the help button that more or less says. "This is how you setup a basic custom Cron with maybe a few examples" I clicked on Custom and my Brain went into... Uh, How do I do this again. Lol Yes I know Google is your friend, but just a minor suggestion and we all like being spoiled by you. 1 Quote Link to comment
Recommended Posts
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.