Page 1 of 1

[SOLVED] How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 6th, '16, 00:00
by tdmsoares
I want to set my computer to suspend after 30 minutes from now. I already know how set to suspend my computer right now, I type the following in terminal:

Code: Select all
$ pm-suspend


Searching in internet, I found the solution is to type:

Code: Select all
$ echo pm-hibernate | sudo at now + 30 min


But when I type the above in my Terminal, I get that message: at: command not found

Is this command not default in Linux? Is it a command from a particular distro and, if so, how can I substitute it?

Thanks!

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 6th, '16, 01:14
by Ken-Bergen
Your problem is not with at but with sudo
See
Code: Select all
man visudo
for information on setting up sudo.

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 6th, '16, 01:36
by tdmsoares
Even when I log as Root (not using `sudo`) I have the same problem

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 6th, '16, 02:54
by Ken-Bergen
As I didn't install "at" I assumed it was installed by default.
If you used the Live CD or DVD perhaps not.
Anyway it's in the repositories so install it and try again.

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 6th, '16, 18:47
by doktor5000
Ken-Bergen wrote:If you used the Live CD or DVD perhaps not.

I think it's not even included in a regular install from DVD, as when I install chrome on a fresh install it always pulls in at ...

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 13th, '16, 01:04
by tdmsoares
`at` wasn't installed in my system... I just installed, but I found only the version for 32 bits...

After restarting the system, now I can type the command below without warnings:

Code: Select all
$ echo pm-suspend | sudo at now + 1 min


The only problem I'm facing now is that command doesn't work: after one minute, for example as above, the system doesn't suspend

Is there something I missed?

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 13th, '16, 03:09
by Ken-Bergen
tdmsoares wrote:The only problem I'm facing now is that command doesn't work: after one minute, for example as above, the system doesn't suspend

Is there something I missed?
It works for me.
Code: Select all
[ken@localhost]$ echo pm-suspend | sudo at now + 1 min
warning: commands will be executed using (in order) a) $SHELL b) login shell c) /bin/sh                                                                     
job 4 at Sun Jun 12 17:54:00 2016
What do you see?

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 14th, '16, 01:00
by tdmsoares
I see the same warning, like the one you posted. In that case, probably you ran the command at 17:53 I guess...
The problem when the scheduled time comes, nothing happens...
I don't know if your computer suspended at 17:54, did it?

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 14th, '16, 05:24
by Ken-Bergen
tdmsoares wrote:I don't know if your computer suspended at 17:54, did it?
Yes it did.

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 15th, '16, 01:00
by tdmsoares
I don't know why the command doesn't work for me...
The only available version of `at` in repository was i586, my system is x86_64, does it make any difference?

Maybe the best solution is to uninstal `at` and make a workaround with crontab using shell script...

I am doing something like that in vim:

Code: Select all
sleep 60
pm-suspend

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 15th, '16, 02:38
by Ken-Bergen
tdmsoares wrote:I don't know why the command doesn't work for me...
The only available version of `at` in repository was i586, my system is x86_64, does it make any difference?
There is a 64bit version of at in the repositories which is what I have installed.
It would seem your sources are miss-configured or the mirror you're using is bad.

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 15th, '16, 17:42
by doktor5000
Please show the output of
Code: Select all
urpmq --list-media active --list-url

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 16th, '16, 00:59
by tdmsoares
doktor5000 wrote:Please show the output of
Code: Select all
urpmq --list-media active --list-url


I get this:

Code: Select all
[tdms@localhost ~]$ urpmq --list-media active --list-url
Core Release cdrom://x86_64/media/core
Nonfree Release cdrom://x86_64/media/nonfree
Core Release2 http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/core/release
Core Updates http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/core/updates
Nonfree Release2 http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/nonfree/release
Nonfree Updates http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/nonfree/updates
Tainted Release http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/tainted/release
Tainted Updates http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/tainted/updates
Core 32bit Release http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/i586/media/core/release
Core 32bit Updates http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/i586/media/core/updates
Nonfree 32bit Release http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/i586/media/nonfree/release
Nonfree 32bit Updates http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/i586/media/nonfree/updates



I think I have both repositories for 32 and 64 bits. Why do I have a repository named Core Release and Core Release 2, is there any difference?

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 16th, '16, 01:32
by Ken-Bergen
Core Release cdrom: is a subset of the online Core Release2.
at is present on http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/core/release so in a console as root
Code: Select all
urpme at
then
Code: Select all
urpmi at
should get you the x86_64 version.

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 16th, '16, 05:11
by tdmsoares
Ken-Bergen wrote:Core Release cdrom: is a subset of the online Core Release2.
at is present on http://ftp.las.ic.unicamp.br/pub/mageia/distrib/5/x86_64/media/core/release so in a console as root
Code: Select all
urpme at
then
Code: Select all
urpmi at
should get you the x86_64 version.


It finally worked!!! Thank you! :D
So, it was only a problem with the version of at, right? :?

Although the problem is solved, I have some questions remaining: Why in MCC before, it showed only the i586 version, and now only typing the code
Code: Select all
urpme at
and
Code: Select all
urpmi at
without any setup in repositories I could install the x86_64 version?

Is the i586 version not compatible with a 64 bits OS anymore?

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 16th, '16, 17:31
by doktor5000
tdmsoares wrote:So, it was only a problem with the version of at, right? :?

No, not with the version but the architecture.

tdmsoares wrote:Although the problem is solved, I have some questions remaining: Why in MCC before, it showed only the i586 version, and now only typing the code without any setup in repositories I could install the x86_64 version?

urpmi will default to --strict-arch, so if there is the same package both for i586 and x86_64 and you only install a package by name it will always install the package for your native architecture.

In MCC if you explicitly select the i586 version, it will install that which is not what you want.
And in general you can run i586 code under x86_64, but not the other way around. Why it didn't work for at for you, is hard to tell without further information/debugging.

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 17th, '16, 00:47
by tdmsoares
I think better than only solve the problems is to learn a little bit more
Thank you for the answers!

Re: How can I use the `at` command in Mageia Terminal?

PostPosted: Jun 17th, '16, 16:18
by doktor5000
tdmsoares wrote:I think better than only solve the problems is to learn a little bit more

Yes, exactly. Feel free to ask if anything is still unclear.

FWIW, usually I assume if people don't ask further questions than their needs are fulfilled. I stopped at some point explaining stuff to everybody in detail, as the vast majority of forum users will simply ignore it, and ask the same question few months later again, having not learned anything and having forgotten the several threads where they asked about that same issue already before :|