Hello,
I am relative new to Linux.
I need to check many Laptops Batterys, out of this reason i created a USB Stick with Linux Mint.
I already installed acpitool to check the stat of the batteries.
Now i want at the startup of Linux to open a terminal which executes the command acpitool -BV.
I was able to get the terminal on Startup.
I reated a new command on startup.
The command is /usr/bin/gnome-terminal
But whatever i do i cannot open the terminal and have the command executed.
I dont know what to enter in the autostart so that the terminal opens and i see the fulfilled command.
Terminal on Autostart [SOLVED]
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Terminal on Autostart [SOLVED]
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Terminal on Autostart
The issue is that the whilst you can get the terminal to run a command, it will terminate and close afterwards, so the "trick" is to create a small shell script that runs the required command and then waits for user input before closing. So create a file, for example
You'll need to change the permissions so that it can be executed. You should also change the owner so that no other user can alter the contents of the script and make it do something that you don't want...
The final line above will run your command and then wait for you to enter something on the keyboard, at this point simply pressing <ENTER> is enough.
Now you can simply add your autostart command to be
/usr/local/sbin/battcheck
and add the following contents...
Code: Select all
#!/bin/bash
acpitool -BV
read x
Code: Select all
cd /usr/local/sbin
sudo chmod 755 battcheck
sudo chown root:root battcheck
./battcheck
Now you can simply add your autostart command to be
/usr/bin/gnome-terminal -- /usr/local/sbin/battcheck
. Note the double dash after 'gnome-terminal'. That worked on my Mint 20.1 system.Re: Terminal on Autostart
Thank you very much.
Now my Linux starts with the terminal and shows me the capacity
Now my Linux starts with the terminal and shows me the capacity
Re: Terminal on Autostart
Good to know that it works for you.
Another option, would be to use a command called
This would keep the terminal window open, running the command every 5 seconds. You can stop it at any time using Ctrl-C and the terminal will close.
Please mark your topic as solved for future readers.
Another option, would be to use a command called
watch
, which will repeat the command that it is given. So rather than passing the 'battcheck' script as the gnome-terminal argument, you could do the following instead...
Code: Select all
gnome-terminal -- watch -n 5 acpitool -BV
Please mark your topic as solved for future readers.