DZMM Posted June 15, 2018 Share Posted June 15, 2018 Is there a way to install a plugin from a script/terminal and then remove it via another script? E.g. I can't use the rclone plugin as it needs to download rclone at unraid boot and my server isn't online because I have a pfsense VM.   I've created my own frankenstein script to do a full rclone install, but I'd much rather have a script that installs https://github.com/Waseh/rclone-unraid/blob/master/plugin/rclone.plg a few mins after boot once my network is live, and removed it at shutdown.  Thanks in advance for any help Link to comment
Squid Posted June 16, 2018 Share Posted June 16, 2018 plugin install /path/to/nameOfplgFile.plg and plugin remove nameOfplgFile.plg  You could use the user scripts plugin to schedule it at array start and stop (script something like off the top of my head) echo "/usr/local/sbin/plugin install /path/to/.plgFile" | at NOW + 5 min  *But, the plugin when installed after the array is started *should* be saving any download that it has to make so that when it installs during boot it doesn't need to redownload it. (Quick look and it appears that it is) Link to comment
DZMM Posted June 16, 2018 Author Share Posted June 16, 2018 Thank you so much - this has solved so many issues for me. Worked perfectly. Link to comment
pimogo Posted August 18, 2018 Share Posted August 18, 2018 i'm trying to do this, but when i run this script with the user scripts plugin, with the command below i get the following error.. Confused.  /tmp/user.scripts/tmpScripts/install rclone on startup/script: line 5: plugin: command not found.  plugin install https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg Link to comment
DZMM Posted August 18, 2018 Author Share Posted August 18, 2018 27 minutes ago, pimogo said: i'm trying to do this, but when i run this script with the user scripts plugin, with the command below i get the following error.. Confused.  /tmp/user.scripts/tmpScripts/install rclone on startup/script: line 5: plugin: command not found.  plugin install https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg check the link - it's a 404. I don't know how but somehow you've got an illegal character in there or something as when I copy and paste your link it doesn't work but when I use the actual one https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg it does. Try it and see.  If my link doesn't work because of some weird thing the forum has done to it then type it manually or get it from here https://github.com/Waseh/rclone-unraid/tree/master/plugin Link to comment
pimogo Posted August 18, 2018 Share Posted August 18, 2018 thanks for the repsonse!! same thing.. it seems it doesn't understnad the command "plugin". yet when i install rclone via CA, it works fine...  #!/bin/bash plugin install https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg   Script location: /tmp/user.scripts/tmpScripts/test/scriptNote that closing this window will abort the execution of this script/tmp/user.scripts/tmpScripts/test/script: line 2: plugin: command not found  Link to comment
DZMM Posted August 18, 2018 Author Share Posted August 18, 2018 there was something weird with the link you posted not the command - the link is going to a 404 page Link to comment
Squid Posted August 18, 2018 Share Posted August 18, 2018 21 hours ago, pimogo said: plugin install https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg Change it to /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin install https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg  Link to comment
bonienl Posted August 19, 2018 Share Posted August 19, 2018 Recommended is: /usr/local/sbin/plugin https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg  Link to comment
DZMM Posted August 19, 2018 Author Share Posted August 19, 2018 Can someone explain briefly what the difference is please as using 'plugin install' has 'worked' perfectly fine for me. Should I be using this command?  1 hour ago, bonienl said: Recommended is: /usr/local/sbin/plugin https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg   Link to comment
pimogo Posted August 19, 2018 Share Posted August 19, 2018 10 hours ago, Squid said: Change it to /usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg  thanks! i shall try this! Link to comment
pwm Posted August 19, 2018 Share Posted August 19, 2018 1 hour ago, DZMM said: Can someone explain briefly what the difference is please as using 'plugin install' has 'worked' perfectly fine for me. Should I be using this command?    The command "plugin xxx" says - use the first command named "plugin" found in the search path. So if there are multiple programs named "plugin", then you aren't in control of exactly which of them that is run. And if the command "plugin" is installed in a directory that isn't in the search path, then the command fails.  The command "/usr/local/sbin/plugin xxx" names a very specific program "plugin" by giving a fully qualified name. Link to comment
DZMM Posted August 19, 2018 Author Share Posted August 19, 2018 1 hour ago, pwm said:  The command "plugin xxx" says - use the first command named "plugin" found in the search path. So if there are multiple programs named "plugin", then you aren't in control of exactly which of them that is run. And if the command "plugin" is installed in a directory that isn't in the search path, then the command fails.  The command "/usr/local/sbin/plugin xxx" names a very specific program "plugin" by giving a fully qualified name.  What would I use for remove? Currently I do:  plugin remove rclone.plg  Link to comment
bonienl Posted August 19, 2018 Share Posted August 19, 2018 Type the command 'plugin' without any options and you'll get the help information Process plugin files. Usage: plugin install PLUGIN-FILE [forced] install a plugin PLUGIN-FILE is a plugin definition XML file with ".plg" extension. PLUGIN-FILE can be a local file, or a URL. If a URL, the plugin file is first downloaded to /tmp/plugins. forced is optional and can be used to install a lower version than currently running. This command will process all FILE elements in PLUGIN-FILE which are tagged with the "install" method (or that have no method tag). This command has two major use cases: 1) Invoked at system startup by /etc/rc.d/rc.local on each .plg file found int /boot/config/plugins. Upon success we register the plugin as "installed" by creating a symlink to it in /var/log/plugins. If any kind of error, we move the file to /boot/config/plugins-error. If a symlink already exists for the plugin file, this indicates a plugin replacing a "built-in" plugin. In this case, if the version of PLUGIN-FILE is newer than the built-in plugin, we go ahead and install normally; otherwise, we move to /boot/config/plugins-stale. 2) Invoked manually or via Plugin Manager for a .plg file not in /boot/config/plugins. If a symlink already exists for the plugin file, this indicates a plugin update. In this case, if the version of PLUGIN-FILE is newer than the built-in plugin, we go ahead and install normally and then move the old plugin to /boot/config/plugins-stale. Upon success we copy PLUGIN-FILE to /boot/config/plugins and register it as "installed" by creating a symlink to it in /var/log/plugins. Usage: plugin remove PLUGIN remove a plugin PLUGIN is the file basename of a plugin, e.g., "myplugin.plg". If PLUGIN is found in /var/log/plugins then this command will process all FILE elements in PLUGIN which are tagged with the "remove" method. Upon success we delete /var/log/plugins/PLUGIN and move the plugin file to /boot/config/plugins-removed Usage: plugin check PLUGIN check and output the latest version of PLUGIN We exract the pluginURL attribute from PLUGIN and use it to download (presumably the latest version of) the plugin file to /tmp/plugins/ directory, and then output the version string. Usage: plugin checkall check all installed plugins Runs 'plugin check PLUGIN' for each plugin file linked-to in /var/log/plugins. Usage: plugin update PLUGIN update the plugin We look for the new plugin in /tmp/plugins/ directory. If found then we first execute the "install" method of each FILE in the new plugin. (If necessary, a plugin can detect that this is an "update" by checking for the existence of /var/log/plugins/PLUGIN.) If successful, we delete the "old" plugin file from /boot/config/plugins/, copy the "new" plugin file from /tmp/plugins/ to /boot/config/plugins/, and finally create the new symlink. Note: to support `plugin check` and `plugin update` the plugin file must contain both "pluginURL" and "version" attributes. Usage: plugin [attribute name] PLUGIN Any method which is not one of the actions listed above is assumed to be the name of an attribute of the <PLUGIN> tag within PLUGIN-FILE. If the attribute exists, its value (a string) is output and the command exit status is 0. If the attribute does not exist, command exit status is 1. The plugin manager recognizes this set of attributes for the <PLUGIN> tag: name - MANDATORY plugin name, e.g., "myplugin" or "my-plugin" etc. This tag defines the name of the plugin. The name should omit embedded information such as architecture, version, author, etc. The plugin should create a directory under `/usr/local/emhttp/plugins` named after the plugin, e.g., `/usr/local/emhttp/plugins/myplugin`. Any webGui pages, icons, README files, etc, should be created inside this directory. The plugin should also create a directory under `/boot/config/plugins` named after the plugin, e.g., `/boot/config/plugins/myplugin`. Here is where you store plugin-specific files such as a configuration file and icon file. Note that this directory exists on the users USB Flash device and writes should be minimized. Upon successful installation, the plugin manager will copy the input plugin file to `/boot/config/plugins` on the users USB Flash device, and create a symlink in `/var/log/plugins` also named after the plugin, e.g., `/var/log/plugins/myplugin`. Each time the unRaid server is re-booted, all plugins stored in `/boot/config/plugins` are automatically installed; plugin authors should be aware of this behavior. author - OPTIONAL Whatever you put here will show up under the **Author** column in the Plugin List. If this attribute is omitted we display "anonymous". version - MANDATORY Use a string suitable for comparison to determine if one version is older/same/newer than another version. Any format is acceptable but LimeTech uses "YYYY.MM.DD", e.g., "2014.02.18" (if multiple versions happen to get posted on the same day we add a letter suffix, e.g., "2014.02.18a"). pluginURL - OPTIONAL but MANDATORY if you want "check for updates" to work with your plugin This is the URL of the plugin file to download and extract the **version** attribute from to determine if this is a new version. system - OPTIONAL If present the plugin is considered a system plugin and is installed in '/boot/plugins'. User plugins get installed in '/boot/config/plugins', which is the default. More attributes may be defined in the future. Here is the set of directories and files used by the plugin system: /boot/config/plugins/ This directory contains the plugin files for plugins to be (re)installed at boot-time. Upon successful `plugin install`, the plugin file is copied here (if not here already). Upon successful `plugin remove`, the plugin file is deleted from here. /boot/config/plugins-error/ This directory contains plugin files that failed to install. /boot/config/plugins-removed/ This directory contains plugin files that have been removed. /boot/config/plugins-stale/ This directory contains plugin files that failed to install because a newer version of the same plugin is already installed. /tmp/plugins/ This directory is used as a target for downloaded plugin files. The `plugin check` operation downloads the plugin file here and the `plugin update` operation looks for the plugin to update here. /var/log/plugins/ This directory contains a symlink named after the plugin name (not the plugin file name) which points to the actual plugin file used to install the plugin. The existence of this file indicates successful install of the plugin. Â Link to comment
DZMM Posted August 19, 2018 Author Share Posted August 19, 2018 23 minutes ago, bonienl said: Type the command 'plugin' without any options and you'll get the help information  Sorry, what I meant was the full path version didn't have the word 'install' in it, like the way I was doing it, so I wasn't sure if I was supposed change my 'plugin remove' command to:  /usr/local/sbin/plugin remove https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg I just want to be 100% certain as 3/4 of my content is on gdrive now, so I want to make sure I mount/unmount correctly via rclone  Link to comment
Squid Posted August 19, 2018 Share Posted August 19, 2018 5 minutes ago, DZMM said: I was supposed change my 'plugin remove' command to: Yes - If it doesn't work  9 hours ago, DZMM said: Can someone explain briefly what the difference is please as using 'plugin install' has 'worked' perfectly fine for me. As stated, it forces the script to run a particular command from a particular folder. More to the point however is that not all the "search paths" (when you don't specify a explicit path) are valid when running a script that isn't started via the command prompt (ie: via User Scripts) Link to comment
DZMM Posted August 19, 2018 Author Share Posted August 19, 2018 4 minutes ago, Squid said: Yes - If it doesn't work  As stated, it forces the script to run a particular command from a particular folder. More to the point however is that not all the "search paths" (when you don't specify a explicit path) are valid when running a script that isn't started via the command prompt (ie: via User Scripts) Thanks - I'm going to use the full path anyway to play it safe  /usr/local/sbin/plugin remove rclone.plg  Link to comment
pimogo Posted August 19, 2018 Share Posted August 19, 2018 So this is odd,.. i tried entering the aforementioned command as suggested. /usr/local/sbin/plugin https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg but got the help information for the plugin instead. It overlook the URL completely. I tried it in User scripts. Same thing.  Am i missing something? Link to comment
itimpi Posted August 19, 2018 Share Posted August 19, 2018 Looking at what the Help displayed I think the remove option wants the path to the .plg file to be removed, not a URL. Link to comment
pimogo Posted August 19, 2018 Share Posted August 19, 2018 my mistake. i posted the wrong command above. in fact, i entered the suggested command for me: /usr/local/sbin/plugin https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg  Link to comment
Squid Posted August 19, 2018 Share Posted August 19, 2018 2 minutes ago, pimogo said: my mistake. i posted the wrong command above. in fact, i entered the suggested command for me: /usr/local/sbin/plugin https://raw.githubusercontent.com/Waseh/rclone-unraid/master/plugin/rclone.plg  There was a typo "install" needs to be after "plugin" Link to comment
pimogo Posted August 19, 2018 Share Posted August 19, 2018 2 minutes ago, Squid said: There was a typo "install" needs to be after "plugin" Â of course.. i'm an idiot.. i took the code verbatim.. thanks Squid for all you do! much appreciated!! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.