Run OMNeT++ simulation from terminal using Qtenv - omnet++

I'm using Veins (v5.1) along with SUMO (v0.32) and OMNeT++ (v5.6.2) in Linux Ubuntu 20.04 and I'm trying to run the Qtenv from the terminal with the opp_run command. When the simulation window opens I still need to click run (F5) in order to start the simulation. Is there any way to start the simulation directly while using the Qtenv?

In Qtenv there is no way to start simulation automatically after opening the window.
EDIT
However, based on that question you may try use xdotool to start simulation by sending F5, for example:
xdotool search --name Qtenv windowactivate --sync %1 key F5 windowactivate `xdotool getactivewindow`
where Qtenv is a part of the title of window with your simulation.

Related

Activate window in Ubuntu 20.04 and send key combination

In Ubuntu 20.04, I am trying to write a very small script to bring a specified window to the foreground and then send a key combination on this window.
For that I am using:
#!/bin/bash
xdotool search --onlyvisible --class <myWindow> windowactivate %#
xdotool key ctrl+alt+p
Now, while the specified window in <myWindow> is indeed coming to the foreground, the key combination seems to not have any effect, no error showed or anything like that. However, it does have the desired effect if I send the combination manually with the keyboard and with the window in the foreground.
I also tried adding a little delay sleep 2 between the 2 commands, no luck so far.
Missing something here?
except windowactivate
maybe also windowfocus
and little sleep ?
xdotool search --onlyvisible --all terminator \
windowactivate windowfocus sleep 0.5 type 'abc'
maybe also --sync
xdotool search --onlyvisible --class terminator \
windowactivate --sync windowfocus --sync key ctrl+r
man xdotool
windowfocus [options] [window]
Focus a window.
Uses XSetInputFocus which may be ignored by some window managers or programs.
--sync
After sending the window focus request, wait until the window is actually focused.
windowactivate [options] [window]
Activate the window.
This command is different from windowfocus: if the window is on another desktop, we will switch to that desktop.
It also uses a different method for bringing the window up.
I recommend trying this command before using windowfocus, as it will work on more window managers.
--sync
After sending the window activation, wait until the window is actually activated.

Pausing a script running in terminal screen?

I'm running a script inside of a terminal screen in a remote machine I ssh'ed in, so I can exit and enter terminal any time. I had thought that to pause the script, I'd just have to either send a ^Z command to the screen, or go into the screen and hit ^Z (or ^A^Z). But neither of them worked. All it did was that it paused the screen -r command I used to enter the screen.
I'm running on a device incapable of installing any dependencies such as reptyr, gcc, or apt-get. That's why I'm resorting to using screens to run/pause my script.

Quit Ubuntu Application by "clicking" the x-Button via Terminal

I am trying to quit a program with a bash script. The problem is that it has to be quit via the the x-button to save some settings. So pkill program do not work in my case. I know that I have to sent a signal for the x-button but I can not find witch one.

Bash script executes fine on its own, but not with cron

I type
crontab -e
my crontab looks like
*/1 * * * * /home/sara/Desktop/kioskscripts/reloadpage.sh >> /home/sara/Desktop/kioskscripts/logfile.log
logfile is created in /kioskscripts but remains empty.
reloadpage.sh looks like this
#!/bin/bash
sleep 5
/usr/bin/xdotool key F5
sh reloadpage.sh
works as expected and simulates f5 being pressed 5 seconds after execution.
The program executed by cron does not have an active window, so you would need to explicitly specify which window you want the keystroke to be sent to using the --window option.
You can get the window id of your currently active window with xdotool getactivewindow and then use that number in an xdotool command. Or you can use xdotool search with various options to find the window you want to direct the keystroke to. Read man xdotool for the various search options. (You can do that in a single command: xdotool search --name Foo key F5 will send F5 to a window with FOO in its name.)
But that will only work if the indicated window accepts the events, and many windows don't.

Auto Restart SH script on crash?

Hi there guys i have a server running a game I've created and it has three SH scripts that are required to run in separate terminals so what i wanna know is 2 things.
1:is there a way i can get a single script that i double click on and launch all three scripts to where i can see the shell (for Debugging)
2: Is there any way to have said scripts auto restart when they exit or crash? (for full automated access when the server is unattended by a dev)
Server Specs:
6gb ram 60gb SSD 6 core CPU
Ubuntu 14.04
with vnc for desktop control
Here's a SH script for you.
running=1
finish()
{
running=0
}
trap finish SIGINT
while (( running )); do
// Execute the command here that starts your server.
echo "Restarting server on crash.."
sleep 5
done
You can run this script for each server in it's own screen. That way you can see the console output of each one. For example:
screen -S YOURUNIQUENAME -m THESCRIPTABOVE.sh
In order to detach from the screen, hit CTRL + A then CTRL + D. You can get back to the screen by using screen -x YOURUNIQUENAME
For a nice guide on using the screen command, see this article: http://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/ . It even has a video to show how it's used.

Resources