Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

[solved] howto send command to start mprime calculation?

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
19 posts • Page 1 of 1
Author
Message
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

[solved] howto send command to start mprime calculation?

  • Quote

Post by Mgiese » Wed Jun 28, 2023 2:00 pm

Hi there,

I don´t want to manually tell mprime/prime95 to start the calculation. ATM I have to start the software (console) then press 4 as soon as the menu appears to start/restart the calculation.

So far I tried using pipes:

Code: Select all

echo 4 | ./mprime -d -m
and also

Code: Select all

xdotool key 4 | ./mprime -d -m
as well as

Code: Select all

xdotool key 4 enter | ./mprime -d -m
all of the afore mentioned commands don´t work to my content.

Also starting mprime then using && operator and simulating a keystroke wont work, since one had to exit mprime in order to start the second command.



Any ideas ?
Last edited by Mgiese on Sun Jul 02, 2023 1:53 pm, edited 1 time in total.
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Thu Jun 29, 2023 6:05 am

Code: Select all

xdotool type "./mprime -d -m"; xdotool key Return; xdotool key 4
or

Code: Select all

xdotool type "./mprime -d -m"; xdotool sleep 0.3; xdotool key Return; xdotool key 4
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Thu Jun 29, 2023 9:16 am

proteusx wrote:

Code: Select all

xdotool type "./mprime -d -m"; xdotool key Return; xdotool key 4
or

Code: Select all

xdotool type "./mprime -d -m"; xdotool sleep 0.3; xdotool key Return; xdotool key 4
that (both code fragments) does not work. it starts mprime and thats it
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
ts-plus
n00b
n00b
User avatar
Posts: 26
Joined: Tue Dec 04, 2012 12:31 pm
Location: Germany

  • Quote

Post by ts-plus » Thu Jun 29, 2023 9:56 am

What about configuring it manually only once and then start it without the "-m" switch?
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Thu Jun 29, 2023 12:18 pm

Mgiese wrote:that (both code fragments) does not work. it starts mprime and thats it
Needs one more "sleep" and a "Return" at the end.

Code: Select all

xdotool type "./mprime -d -m"; xdotool sleep 0.3; xdotool key Return; xdotool sleep 0.3; xdotool key 4; xdotool key Return
Better to do it with a script:

Code: Select all

#!/usr/bin/xdotool
type "./mprime"
sleep 0.3
key Return
key 4
sleep  0.3
key Return

# uncomment  these if it asks for "Worker to start"
# sleep  0.3
# key Return 
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 11:10 am

Thank you, your script as well as your code works.

I am getting crazy here though. Whenever I want to run your script outside the mprime dir, it does not find the binary or the subcommands anymore

Code: Select all

bash: ./mprime: No such file or directory
user@pc ~ $ 4
bash: 4: command not found
I tried various things. Changing with "cd" into the directory does not work either, although I checked with "pwd" that I am actually in the desired directory..

Thanks for hints

PS : I need to start the script in a Terminal (that stays open) at User Logon.
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
ts-plus
n00b
n00b
User avatar
Posts: 26
Joined: Tue Dec 04, 2012 12:31 pm
Location: Germany

  • Quote

Post by ts-plus » Fri Jun 30, 2023 11:51 am

You'd need to add the absolute path of mprime to the first type command of the xdotool script:

Code: Select all

#!/usr/bin/xdotool
type "/opt/mprime/mprime"
sleep 0.3
...
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 12:07 pm

ts-plus wrote:You'd need to add the absolute path of mprime to the first type command of the xdotool script:

Code: Select all

#!/usr/bin/xdotool
type "/opt/mprime/mprime"
sleep 0.3
...
I tried that. Does not help
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 12:13 pm

I tried this now, but it also fails :

Code: Select all

$ konsole --workdir /home/user/number -e "./command"
where command (located /home/user/command) contains the following (in the afore mentioned directory working) commands :

Code: Select all

xdotool type "./mprime -d -m"; xdotool sleep 0.3; xdotool key Return; xdotool sleep 0.3; xdotool key 4; xdotool key Return
this is the error :

Code: Select all

Warning: Could not start program '/home/user/number/command' with arguments ''.
Warning: execve: Exec format error
I also put /bin/bash in front of ./command, which just opens and closes the terminal without any error message
Last edited by Mgiese on Fri Jun 30, 2023 9:08 pm, edited 2 times in total.
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
proteusx
Guru
Guru
User avatar
Posts: 340
Joined: Mon Jan 21, 2008 11:35 am

  • Quote

Post by proteusx » Fri Jun 30, 2023 12:23 pm

Try this, but replace "~/tmp/prime95/" with your own prime95 directory.

Code: Select all

#!/usr/bin/xdotool
type "~/tmp/prime95/mprime"
sleep 0.3
key Return
key 4
sleep  0.3
key Return
sleep  0.3
key Return
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 12:24 pm

Code: Select all

/bin/bash command.sh 
in itself also does work

but

Code: Select all

konsole -e "/bin/bash ./command.sh"
does not, it just opens the konsole and closes it
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 1:14 pm

I figured something out that works for me (although a bit weird)

in ~/.config/autostart I had :

Code: Select all

$ cat prime.desktop 
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=primeALT
Comment=prime
Exec=konsole -e "/bin/bash start"
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false
This started a konsole with mprime but without starting any calculation.

I manually created :

Code: Select all

$ cat test.desktop 
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=prime-neu
Comment=prime-manuel
Exec=./mprimedir/test1.sh
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false
where test1.sh contains the following :

Code: Select all

#!/usr/bin/xdotool
type "~/mprimedir/mprime -d -m"
sleep 0.3
key Return
sleep 0.3
key 4
sleep  0.3
key Return

# uncomment  these if it asks for "Worker to start"
# sleep  0.3
# key Return
please neglect the 2 cat commands (I am tired).

For me it looks like, as if the first command starts the konsole with mprime in it and the second command executs that xdotool command in the window of the first command. Frankly, I don´t mind as long as it works and IT DOES :)

Since I was confused by this behaviour I disabled prime.desktop( which only starts mprime in a konsole) and indeed the test.desktop is useless in itself and does nothing (not even opening a konsole) but combining these 2 lead to the desired condition
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 10:54 pm

Mgiese wrote:I figured something out that works for me (although a bit weird)

in ~/.config/autostart I had :

Code: Select all

$ cat prime.desktop 
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=primeALT
Comment=prime
Exec=konsole -e "/bin/bash start"
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false
This started a konsole with mprime but without starting any calculation.

I manually created :

Code: Select all

$ cat test.desktop 
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=prime-neu
Comment=prime-manuel
Exec=./mprimedir/test1.sh
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false
where test1.sh contains the following :

Code: Select all

#!/usr/bin/xdotool
type "~/mprimedir/mprime -d -m"
sleep 0.3
key Return
sleep 0.3
key 4
sleep  0.3
key Return

# uncomment  these if it asks for "Worker to start"
# sleep  0.3
# key Return
please neglect the 2 cat commands (I am tired).

For me it looks like, as if the first command starts the konsole with mprime in it and the second command executs that xdotool command in the window of the first command. Frankly, I don´t mind as long as it works and IT DOES :)

Since I was confused by this behaviour I disabled prime.desktop( which only starts mprime in a konsole) and indeed the test.desktop is useless in itself and does nothing (not even opening a konsole) but combining these 2 lead to the desired condition



EDIT : that worked as long as i only logged in and out. when doing a real restart one timing flaw appeared. i had to add an extra "sleep 3" at the beginning to the test1.sh script. obviously the prime.desktop and test.desktop are being started simultaneously and the test.desktop could not execute as desired due to a not yet loaded instance of mprime.
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Fri Jun 30, 2023 11:16 pm

Wait, why do you even use xdotool?
This thing you're trying to run is a command-line program, right? Is there any problem with its interface?
Doesn't it have batch mode, where you provide everything as arguments?
If it really requires standard input, can't you solve it with a simple redirection? You mentioned that pipe didn't work, but you didn't say why. Is there a delay or something?
{ sleep 1; echo stdinput; } | application

Though really, things like

Code: Select all

/path/to/application << eof
multiline text
to be redirected
to stdin
eof
should work
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Fri Jun 30, 2023 11:23 pm

szatox wrote:Wait, why do you even use xdotool?
This thing you're trying to run is a command-line program, right? Is there any problem with its interface?
Doesn't it have batch mode, where you provide everything as arguments?
If it really requires standard input, can't you solve it with a simple redirection? You mentioned that pipe didn't work, but you didn't say why. Is there a delay or something?
{ sleep 1; echo stdinput; } | application

Though really, things like

Code: Select all

/path/to/application << eof
multiline text
to be redirected
to stdin
eof
should work
i like the idea of doing it easier than i do now and the educational aspect of it. though i don´t understand some of the things in your example script :

what does "<< eof" ?

i guess the single "eof" closes me putting things in std input ?

and i guess these "multiline text, to be redirected, to stdin" are example commands like pressing the number 4, for menupoint 4 for instance ?

i dont know if mprime has a batch mode and if there is something wrong with its interface, though i guess not.
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Fri Jun 30, 2023 11:54 pm

there are several redirection operators in shell.
< filename
<< terminator_string_for_multiline_input
<<< "one line input string"

try them and see, handy stuff when scripting.
like pressing the number 4, for menupoint 4 for instance
yeah, though now that I read it, "menupoint number 4" suggests a problem to me.
Does it use ncurses, commander, or other similarly advanced interface? Like in: it runs in a terminal, but acts kinda like gui, responding to events (e.g. button pressed) rather than input text?
For example there is an obvious difference in the way fdisk or gdisk (or just sh) ingest input. Even though fdisk is a human-interactive, you can just inject commands from a file and it will happily obey. Top wouldn't even start.
Top
ts-plus
n00b
n00b
User avatar
Posts: 26
Joined: Tue Dec 04, 2012 12:31 pm
Location: Germany

  • Quote

Post by ts-plus » Sat Jul 01, 2023 8:23 am

ts-plus wrote:What about configuring it manually only once and then start it without the "-m" switch?
I'd like to point out (again), that propably the easiest solution to your problem would be to call "mprime -d". As the -m switch stands for "menu", there is no need to interact in any way and it will simply start.
Top
Mgiese
Veteran
Veteran
User avatar
Posts: 1638
Joined: Wed Mar 23, 2005 5:25 pm
Location: indiana
Contact:
Contact Mgiese
Website

  • Quote

Post by Mgiese » Sat Jul 01, 2023 9:52 am

ts-plus wrote:
ts-plus wrote:What about configuring it manually only once and then start it without the "-m" switch?
I'd like to point out (again), that propably the easiest solution to your problem would be to call "mprime -d". As the -m switch stands for "menu", there is no need to interact in any way and it will simply start.
i read you comment and just forgot to answer :) i would like to see the the occasional output (timings and eta) so it´s not of much use. in general i like to tinker a bit with things to educate myself. the harder the better ;)

thank you anyways
I do not have a Superman complex, for I am God not Superman :D

Ryzen9 7950x (powersave governor) ; Radeon 9070 XT ; kernel 6.18.4 ; XFCE ; SYSTEMD
Top
ts-plus
n00b
n00b
User avatar
Posts: 26
Joined: Tue Dec 04, 2012 12:31 pm
Location: Germany

  • Quote

Post by ts-plus » Sat Jul 01, 2023 11:27 am

And that is imho what the -d switch is for.

Code: Select all

./mprime -h    
Usage: mprime [-bcdhmstv] [-aN] [-wDIR] [-pPIDFILE]
-b      Run a predefined throughput benchmark, then exit.
-c      Contact the PrimeNet server, then exit.
-d      Print detailed information to stdout.
-h      Print this.
-m      Menu to configure mprime.
-s      Display status.
-t      Run the torture test.
-v      Print the version number.
-aN     Use an alternate set of INI and output files (obsolete).
-wDIR   Run from a different working directory.
-pPIDFILE       Filename for the PID file.  Default is mprime.pid.
So the following should work:
Call "mprime -d -m" to configure it once (it will create the prime.txt config). After that you can always use "mprime -d" to start it (and get the detailed info). When starting mprime from another directory you might add -w<yourfirst-cwd> to let mprime find your config.
Top
Post Reply

19 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic