alturismo Posted January 14, 2022 Share Posted January 14, 2022 1 hour ago, Sinister said: can anyone assist me with this ? may add a sleep in there as the array needs some time to startup (and the vm service too) the virsh start cmd is correct, here is my VM Cycle script which i made for me to switch VM's while running (Desktop VM with GPU passthrough), not your usecase now, but u see the sleep's i added between to make sure ... #!/bin/bash vm1="AlsLinux" vm2="AlsPC" ## vm_running="running" vm_down="shut off" vm1_state=$(virsh domstate "$vm1") vm2_state=$(virsh domstate "$vm2") echo "$vm1 is $vm1_state" echo "$vm2 is $vm2_state" if [ "$vm1_state" = "$vm_running" ] && [ "$vm2_state" = "$vm_down" ]; then echo "$vm1 is running shutting down" virsh shutdown "$vm1" vm1_new_state=$(virsh domstate "$vm1") until [ "$vm1_new_state" = "$vm_down" ]; do echo "$vm1 $vm1_new_state" vm1_new_state=$(virsh domstate "$vm1") sleep 2 done echo "$vm1 $vm1_new_state" sleep 2 virsh start "$vm2" sleep 1 vm2_new_state=$(virsh domstate "$vm2") echo "$vm2 $vm2_new_state" else if [ "$vm2_state" = "$vm_running" ] && [ "$vm1_state" = "$vm_down" ]; then echo "$vm2 is running shutting down" virsh shutdown "$vm2" vm2_new_state=$(virsh domstate "$vm2") until [ "$vm2_new_state" = "$vm_down" ]; do echo "$vm2 $vm2_new_state" vm2_new_state=$(virsh domstate "$vm2") sleep 2 done echo "$vm2 $vm2_new_state" sleep 2 virsh start "$vm1" sleep 1 vm1_new_state=$(virsh domstate "$vm1") echo "$vm1 $vm1_new_state" else echo "$vm1 $vm1_state and $vm2 $vm2_state doesnt match" fi fi so a simple vm start after array start (wait 15 seconds before vm start command) #!/bin/bash vm1="your_vm_name_here" sleep 15 virsh start "$vm1" and you set in CA scripts Quote Link to comment
Sinister Posted January 14, 2022 Share Posted January 14, 2022 (edited) 35 minutes ago, alturismo said: #!/bin/bash vm1="your_vm_name_here" sleep 15 virsh start "$vm1" So if i understand properly then my script would look like this: #!/bin/bash vm1="pfsense" sleep 15 virsh start "$vm1" where i could even move sleep to 30 ? Edited January 14, 2022 by Sinister Correcting script Quote Link to comment
Sinister Posted January 14, 2022 Share Posted January 14, 2022 47 minutes ago, alturismo said: may add a sleep in there as the array needs some time to startup (and the vm service too) the virsh start cmd is correct, here is my VM Cycle script which i made for me to switch VM's while running (Desktop VM with GPU passthrough), not your usecase now, but u see the sleep's i added between to make sure ... #!/bin/bash vm1="AlsLinux" vm2="AlsPC" ## vm_running="running" vm_down="shut off" vm1_state=$(virsh domstate "$vm1") vm2_state=$(virsh domstate "$vm2") echo "$vm1 is $vm1_state" echo "$vm2 is $vm2_state" if [ "$vm1_state" = "$vm_running" ] && [ "$vm2_state" = "$vm_down" ]; then echo "$vm1 is running shutting down" virsh shutdown "$vm1" vm1_new_state=$(virsh domstate "$vm1") until [ "$vm1_new_state" = "$vm_down" ]; do echo "$vm1 $vm1_new_state" vm1_new_state=$(virsh domstate "$vm1") sleep 2 done echo "$vm1 $vm1_new_state" sleep 2 virsh start "$vm2" sleep 1 vm2_new_state=$(virsh domstate "$vm2") echo "$vm2 $vm2_new_state" else if [ "$vm2_state" = "$vm_running" ] && [ "$vm1_state" = "$vm_down" ]; then echo "$vm2 is running shutting down" virsh shutdown "$vm2" vm2_new_state=$(virsh domstate "$vm2") until [ "$vm2_new_state" = "$vm_down" ]; do echo "$vm2 $vm2_new_state" vm2_new_state=$(virsh domstate "$vm2") sleep 2 done echo "$vm2 $vm2_new_state" sleep 2 virsh start "$vm1" sleep 1 vm1_new_state=$(virsh domstate "$vm1") echo "$vm1 $vm1_new_state" else echo "$vm1 $vm1_state and $vm2 $vm2_state doesnt match" fi fi so a simple vm start after array start (wait 15 seconds before vm start command) #!/bin/bash vm1="your_vm_name_here" sleep 15 virsh start "$vm1" and you set in CA scripts Thank you sir, worked like a charm 1 Quote Link to comment
Nuke Posted January 18, 2022 Share Posted January 18, 2022 (edited) i have a strange bug. i have test script, here it is: #!/bin/bash echo hello if i set cron to * * * * * then each minute all other scripts is force rebooting Is last versions is broken? Edited January 18, 2022 by Nuke Quote Link to comment
Squid Posted January 18, 2022 Author Share Posted January 18, 2022 8 hours ago, Nuke said: then each minute all other scripts is force rebooting What does that mean? Every other script runs every minute or the system is crashing? Quote Link to comment
bryce2113 Posted January 18, 2022 Share Posted January 18, 2022 On 11/27/2021 at 3:43 AM, vw-kombi said: I just noticed my cron based scripts last ran on 19th Nov. The dropdown daily, weekly, hourly ones are running fine. I have some scripts for this however : */5 * * * * - very 5 minutes sync video camera data to hidden laptop 30 23 * * * - Backups every night at 23:30 Any idea where I can go to rectify this ? In there a cron process that has stopped or something ? I'm having the same exact issue, but with a custom weekly schedule 06**0 -- weekly rsync to run every Sunday at 6AM. I've tested with some other custom date configurations and no luck. Quote Link to comment
sunbear Posted January 18, 2022 Share Posted January 18, 2022 Hi, I have an update request for the user scripts plugin I apologize if this is the wrong place for that. Is there anyway we could get a reorganization of the user scripts display? In my opinion, currently it feels very clunky and annoying to try to navigate and find my scripts. I currently have around 50 different scripts and am regularly adding more. The only way I've been able to manage them is to organize all my scripts into groups and the title the scripts with numbers according to those groups. I have to make sure I use the correct title when I add the script because it won't let me change the title again unless I delete and re-add it (I know I can edit the titles but that only changes what's displayed, the alphabetical position only ever uses the first title). And even with that, it's still takes me a good bit of scrolling back and forth to find my scripts. It feels like half of the page is basically not being used. You could reduce each script to use only one single line by moving the description to the right half of the page and reducing the button sizes if necessary. From a glance, it's kind of a pain to see which scripts are being used. Using some sort of colored icon scheme to visually show which scripts are scheduled, what type of schedule they are using, and perhaps any active scripts. And if I could have all my wishes, any easy way to shift different scripts around, organize them into folders that can be folded, and perhaps some kind of hover popups that show any descriptions with clickable links would be a godsend. This is just some basic functionality imagined by someone who has literally zero experience in GUI/web design. I'm sure someone with experience would be able to come up with something even better. I'm aware that this takes work and I would try to do it myself if I knew literally anything at all about web design, html, css, etc. So this is just my last resort. I apologize if others have made similar requests before. Thanks. Quote Link to comment
sunbear Posted January 18, 2022 Share Posted January 18, 2022 Just to reiterate my requests in a clearer format than a block of text, see my following list. Better utilization of full width of the page. Only one script (at least) per line. Foldable or popup script descriptions (w/ clickable url links?) Colored icon or other type of scheme for displaying script activity/status and schedule types at a glance. Script Organization: Ability to shift scripts around. Ability to group into folders. Minimize or hide unused scripts. Separate buttons for quickly renaming/editing description/editing the script each with a single click. Below are just some quick googled examples of things I had in mind. I'm only talking about the visual layout and organization functions of course. Even a slight resemblance to this would be much easier on my OCD brain. Thanks. Collapsible Sections: Activity/Status Icons & simple buttons for each function, some with dropdowns (e.g. for schedule type): Or another idea completely, have a permanently visible display of each script on the right, directly editable (Config File editor plugin is like this): Quote Link to comment
Ryonez Posted January 22, 2022 Share Posted January 22, 2022 (edited) I'm unable to fill a var via a command via scripts currently. Going back, I can see it stopped working correctly on the 14/12/21 (NZT). The command is this: #!/bin/bash -x DBLIST="$(docker exec -t alteria-postgres psql -U postgres -d postgres -q -t -A -c 'SELECT datname from pg_database')" echo "${DBLIST}" I'm at a loss atm, I can't think what would stop this, and the command can be run manually in the terminal, returning the list of databases correctly. The failure was very wonky as well. It saved all the databases fully, then I got zero bit files, then some had data but not all, then the script started running multiple times before outright just stopping. Overview of the base folder: Last Good Backup: When it started messing up Would anyone have any ideas what on earth happened and how to get this working? Edited January 22, 2022 by Ryonez More Info Quote Link to comment
CS01-HS Posted January 24, 2022 Share Posted January 24, 2022 I think there's a minor bug in the abort logic. With 2 scripts running in the background: myTest and myTestAlternate Aborting myTest aborts both (even though the display shows the latter as still running.) I figure the pattern-matching catches both. Not a big deal but FYI. I was trying to figure out why a script I wrote wasn't working, turns out it wasn't running because of the above. Quote Link to comment
CIA Posted January 27, 2022 Share Posted January 27, 2022 Feature Request: Folders... as @sunbear requested too and maybe more I didn't read the whole thread. My list of scripts is getting a little long. Something that would make it simple to impliment and not need a full rewrite.. #category=<name> #description=this is the description of the script #foregroundOnly=true #backgroundOnly=true #arrayStarted=true #name=blah blah blah #argumentDescription=This is the description of the argument(s) #argumentDefault=defaultArg1 defaultArg2 etc Add a combobox for the category selection. The implementation of adding categories is whatever tickles your fancy, I'd take manually just to have a little bit more organization. Then add a dom effect like "accordion" to place each script in the correct area... Anything without the category flag or null, would go into the defualt uncategorized area. And @sunbear if you would like an editor, Just an example is to point you're IDE/Code Editor to the user scripts folder... 1 Quote Link to comment
MadMatt337 Posted January 27, 2022 Share Posted January 27, 2022 (edited) Not sure if it is a bug on my end or what and please excuse my lack of knowledge on the subject as I am quite new to this. I have a script that is running hourly, if the script is still running and the scheduler runs the script again I lose the "running" text and "abort script" button. Now I have not been able to watch this to confirm if it is happening on the first run attempt or say 2-3 times if the script is running for an extended period but it definitely eventually disappears and both the logs and a ps command show the script still running correctly. Not a huge deal in most instances but it would be nice to quickly see at a glance if it is still running or not and have the option to abort it quickly if I am working on something and need to do a reboot. I am running the latest version of user scripts (2021.11.28) on 6.10.0-rc2. edit: Just for reference, the script in my scenario is just a rclone move script. Edited January 27, 2022 by MadMatt337 Quote Link to comment
spacezmonkey Posted February 2, 2022 Share Posted February 2, 2022 Hello , I am trying to run docker-compose using the script , but it show that it is not working I am able to run docker-compose using command, however, in CA user script, it show " docker-compose" not found. may i know how should i write the script to allow docker-compose to be executed. Quote Link to comment
Squid Posted February 3, 2022 Author Share Posted February 3, 2022 give it the full path to docker-compose which docker-compose Quote Link to comment
spacezmonkey Posted February 3, 2022 Share Posted February 3, 2022 Hello @Squid, I am trying to execute docker-compose from /mnt/user/appdata/moodle/ when i try CA script as following, it shows no such file when i change the script to following it gives a similar error Quote Link to comment
tjb_altf4 Posted February 3, 2022 Share Posted February 3, 2022 @spacezmonkey the path in the first script is missing the leading forward slash Quote Link to comment
Squid Posted February 3, 2022 Author Share Posted February 3, 2022 And, I doubt that docker-compose is stored in that directory. It's whereabouts will be given by the output of which docker-compose Quote Link to comment
primeval_god Posted February 3, 2022 Share Posted February 3, 2022 (edited) If you installed the compose plugin you should use docker compose not docker-compose. The older docker-compose syntax should still work i believe but the version of compose installed by the plugin makes compose a subcommand of the docker cli. Edited February 3, 2022 by primeval_god 1 Quote Link to comment
spacezmonkey Posted February 5, 2022 Share Posted February 5, 2022 On 2/4/2022 at 12:04 AM, primeval_god said: If you installed the compose plugin you should use docker compose not docker-compose. The older docker-compose syntax should still work i believe but the version of compose installed by the plugin makes compose a subcommand of the docker cli. @primeval_godthank you. " docker compose " without the "-" works. Quote Link to comment
der8ertl Posted February 10, 2022 Share Posted February 10, 2022 (edited) Hi, thank you for this great plugin. i've been playing around with custom cron settings. unfortunately i cannot get it to run with "0 1 2-31 * 0-4,6" (run at 1:00, from 2nd to 31st day of month, each month, sun to thu and sat of week) i've used https://crontab.guru/ to generate this is this a bug or a feature 😘 any help will be appreciated thank you! Edited February 10, 2022 by der8ertl missing smiley, so nobody gets mad Quote Link to comment
Squid Posted February 10, 2022 Author Share Posted February 10, 2022 Instead of 2-31 and 0-4,6 use 2,3,4,5 .... and 0,1,2,3,4,6 Quote Link to comment
der8ertl Posted February 10, 2022 Share Posted February 10, 2022 i will give it a try and report back thank you! Quote Link to comment
ProphetSe7en Posted February 11, 2022 Share Posted February 11, 2022 I have 2 issue I am trying to figure out 1) how can I get the script to show the same info it would if I ran the commands from the script directly into terminal? 2) How do I get the log button avaliable for the script like I have on other scripts? Quote Link to comment
Squid Posted February 11, 2022 Author Share Posted February 11, 2022 2 hours ago, ProphetSe7en said: 1) how can I get the script to show the same info it would if I ran the commands from the script directly into terminal? It should. But by design this is not run through a "terminal" or anything like that. The output is technically html. (Pretty sure I remember posting a user script that played PacMan in JavaScript at somepoint 2 hours ago, ProphetSe7en said: 2) How do I get the log button avaliable for the script like I have on other scripts? Everything echo'd from your script is what constitutes the log 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.