Code: Select all
root# sudo rtcwake -m disk -s 60
rtcwake: /dev/rtc not enabled for wakeup events
Moderator: Forum moderators
Code: Select all
root# sudo rtcwake -m disk -s 60
rtcwake: /dev/rtc not enabled for wakeup events
Governor
Possible invalid variable for m ?
https://linuxcommandlibrary.com/man/rtcwake
Was unaware that Puppy uses sudo , my understanding is that it is not required as we have root access.
Merry Christmas
what exactly are you trying to do with this command?
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected
https://www.howtogeek.com/121241/how-to ... matically/
It is a test to see how the command works, and if it works. The way I learn how things work is to try them first hand.
I am not so concerned with putting my laptop with the NVME drive to sleep, because I can dismount the external HDDs and unplug them. The laptop is then very quiet since the cooling fan is set to "intelligent cooling".
I have an older HP desktop computer from 2014 which has a typical HDD and fan. It is very noisy. If I boot Puppy using that computer, I want the possibility to put it to sleep until I return and press Ctrl+C. Not only will sleep limit the noise, it will prolong the life of the HDD. I don't know how sleep will affect the fan on the desktop computer, if at all, but at least I can limit the noise of the HDD.
Code: Select all
/dev/rtc not enabled for wakeup events
How do I enable this?
Governor
Jasper wrote: ↑Sat Dec 24, 2022 8:19 am@Governor
Possible invalid variable for m ?
https://linuxcommandlibrary.com/man/rtcwakeWas unaware that Puppy uses sudo , my understanding is that it is not required as we have root access.
Merry Christmas
The sudo command is definitely included in Puppy.
Code: Select all
root# sudo --help
sudo - execute a command as another user
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout]
[-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-C num] [-g group] [-h host] [-p prompt] [-T timeout]
[-u user] file ...
Governor
It is in Puppy, so you do not get an error message, if you use it in a command.
But the command should work without it, because you are always root user.
People got tired of explaining why sudo in a command produced an error, because sudo is not in Puppy.
So they just put sudo in Puppy even if not needed.
People all the time try to use commands in Puppy that they found someplace on the Internet.
Those commands usually will have sudo in them.
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected
The util-linux version of rtcwake is available on Fossapup64 9.5 as rtcwake-FULL
. It should be installed on other puppy variants too. If not, install util-linux.
The busybox rtcwake doesn't work for me. If your /dev/rtc is a symlink to /dev/rtc0, you may try rtcwake -d /dev/rtc0 -m disk -s 60
but it's better to use the full version.
Edit: the busybox rtcwake is not working on my system because it incorrectly sets the rtc wakeup time in local time while the clock itself uses UTC. This makes a much longer delay. A workaround: TZ=UTC0 rtcwake -d /dev/rtc0 -m on -s 60
or rtcwake -d /dev/rtc0 -m on -s 60 --local
even though the -l
option means "clock is set to local time".
Burunduk wrote: ↑Sat Dec 24, 2022 12:56 pmThe util-linux version of rtcwake is available on Fossapup64 9.5 as
rtcwake-FULL
. It should be installed on other puppy variants too. If not, install util-linux.The busybox rtcwake doesn't work for me. If your /dev/rtc is a symlink to /dev/rtc0, you may try
rtcwake -d /dev/rtc0 -m disk -s 60
but it's better to use the full version.Edit: the busybox rtcwake is not working on my system because it incorrectly sets the rtc wakeup time in local time while the clock itself uses UTC. This makes a much longer delay. A workaround:
TZ=UTC0 rtcwake -d /dev/rtc0 -m on -s 60
orrtcwake -d /dev/rtc0 -m on -s 60 --local
even though the-l
option means "clock is set to local time".
How would you place commands in a batch file (script?) in Linux?
Governor
Put the commands in a text file. No file extension is necessary. In Rox right click on the file and hover over >File 'YOUR FILENAME' and choose >Permissions The dialog will show the default option: 'a + x (Make Executable/Searchable)' Click the 'Yes' button.
You might want to insert this at the top of your script:
Code: Select all
#!bin/sh
which indicates the shell interpreter to use.
It can be run by clicking it in Rox, but you won't see any terminal output unless you run from a terminal.
In order to run it anywhere from a terminal, place it /root/my-applications/bin and type the filename from a terminal and hit enter.
geo_c
Old School Hipster, and Such
geo_c wrote: ↑Tue Dec 27, 2022 1:20 pmPut the commands in a text file. No file extension is necessary. In Rox right click on the file and hover over >File 'YOUR FILENAME' and choose >Permissions The dialog will show the default option: 'a + x (Make Executable/Searchable)' Click the 'Yes' button.
You might want to insert this at the top of your script:
Code: Select all
#! bin/sh
which indicates the shell interpreter to use.
It can be run by clicking it in Rox, but you won't see any terminal output unless you run from a terminal.
In order to run it anywhere from a terminal, place it /root/my-applications/bin and type the filename from a terminal and hit enter.
I put my script in /root/my-applications/bin
When I click on it, I get a message that says I need to set "Run Action". How do I do that?
How do I see which directories are in the command path, assuming there is a command path, of course?
Governor
Governor wrote: ↑Tue Dec 27, 2022 2:12 pmgeo_c wrote: ↑Tue Dec 27, 2022 1:20 pmPut the commands in a text file. No file extension is necessary. In Rox right click on the file and hover over >File 'YOUR FILENAME' and choose >Permissions The dialog will show the default option: 'a + x (Make Executable/Searchable)' Click the 'Yes' button.
...
In order to run it anywhere from a terminal, place it /root/my-applications/bin and type the filename from a terminal and hit enter.I put my script in /root/my-applications/bin
When I click on it, I get a message that says I need to set "Run Action". How do I do that?
How do I see which directories are in the command path, assuming there is a command path, of course?
You didn't say whether you did the first part in Rox. Did you?
geo_c
Old School Hipster, and Such
to find the command path:
Code: Select all
echo $PATH
geo_c
Old School Hipster, and Such
geo_c wrote: ↑Tue Dec 27, 2022 2:15 pmGovernor wrote: ↑Tue Dec 27, 2022 2:12 pmgeo_c wrote: ↑Tue Dec 27, 2022 1:20 pmPut the commands in a text file. No file extension is necessary. In Rox right click on the file and hover over >File 'YOUR FILENAME' and choose >Permissions The dialog will show the default option: 'a + x (Make Executable/Searchable)' Click the 'Yes' button.
...
In order to run it anywhere from a terminal, place it /root/my-applications/bin and type the filename from a terminal and hit enter.I put my script in /root/my-applications/bin
When I click on it, I get a message that says I need to set "Run Action". How do I do that?
How do I see which directories are in the command path, assuming there is a command path, of course?You didn't say whether you did the first part in Rox. Did you?
I must have done. I don't see "Rox" anywhere in the GUI, but I believe that is the default app for that.
Usually, I click on "show location" in pMount to access the files, and I think it is Rox that responds to that.
I right clicked on the empty space and chose "new script".
The file contained:
Code: Select all
#!/bin/sh
Which is a little different than what you suggested:
Code: Select all
#! bin/sh
I tried both versions. after adding:
Code: Select all
TZ=UTC0
rtcwake-FULL -d /dev/rtc0 -m on -s 60 --local
The code by itself:
Code: Select all
rtcwake-FULL -d /dev/rtc0 -m on -s 60 --local
[/code]
is definitely doing something when entered at the command line in terminal. It waits 60 seconds and then the command line returns, but there is no countdown and no sleeping or hibernating. I like that I can interrupt it with Ctrl+C
Governor
Governor wrote: ↑Tue Dec 27, 2022 2:42 pmThe file contained:
Code: Select all
#!/bin/sh
Which is a little different than what you suggested:
Code: Select all
#! bin/sh
Sorry. That was a typo. No space should be in inserted. I edited my post. I don't think the error affects it's ability to run.
Rox is the default file manager in fossapup (and most pups if not all.) It's very powerful and unique. And fossapup has many right click options added that aren't available in a generic stock Rox.
The main thing is the script has to be executable. What I described is how to change the permissions of the file to executable using the Rox file manager.
Like I was saying just clicking on script will run it, but if you want to see if it works or is returning errors, you have to run it in a terminal. Which is also a right-click option in Rox. Just right click on the script and choose 'Run in terminal' to see the output.
or, since it's located in /root/my-applications/bin which is part of the command path, just type the name of the scipt in a terminal and hit enter.
geo_c
Old School Hipster, and Such
geo_c wrote: ↑Tue Dec 27, 2022 2:55 pmGovernor wrote: ↑Tue Dec 27, 2022 2:42 pmThe file contained:
Code: Select all
#!/bin/sh
Which is a little different than what you suggested:
Code: Select all
#! bin/sh
Sorry. That was a typo. No space should be in inserted. I edited my post. I don't think the error affects it's ability to run.
Rox is the default file manager in fossapup (and most pups if not all.) It's very powerful and unique. And fossapup has many right click options added that aren't available in a generic stock Rox.
The main thing is the script has to be executable. What I described is how to change the permissions of the file to executable using the Rox file manager.
Like I was saying just clicking on script will run it, but if you want to see if it works or is returning errors, you have to run it in a terminal. Which is also a right-click option in Rox. Just right click on the script and choose 'Run in terminal' to see the output.
or, since it's located in /root/my-applications/bin which is part of the command path, just type the name of the script in a terminal and hit enter.
I think I need to specify a run action, at least that is the message I get in Rox file manager.
I clicked on "window>terminal here" and tried running the script at the prompt, and I got:
Code: Select all
bin/sh: bad interpreter: No such file or directory
Governor
Yes, you need to follow the instructions above and make it executable.
Governor wrote: ↑Tue Dec 27, 2022 3:06 pmI clicked on "window>terminal here" and tried running the script at the prompt, and I got:
Code: Select all
bin/sh: bad interpreter: No such file or directory
Try this instead:
Code: Select all
#!/bin/bash
But you should also be able to run without that piece, called the 'shebang,' and it will use the default interpreter. That's really only necessary if you insert code into the script that is only understood by a certain interpreter. But I'm no scripting wizard.
geo_c
Old School Hipster, and Such
geo_c wrote: ↑Tue Dec 27, 2022 3:12 pmYes, you need to follow the instructions above and make it executable.
Governor wrote: ↑Tue Dec 27, 2022 3:06 pmI clicked on "window>terminal here" and tried running the script at the prompt, and I got:
Code: Select all
bin/sh: bad interpreter: No such file or directory
Try this instead:
Code: Select all
#!/bin/bash
But you should also be able to run without that piece, called the 'shebang,' and it will use the default interpreter. That's really only necessary if you insert code into the script that is only understood by a certain interpreter. But I'm no scripting wizard.
I did not see any instruction on run action, only the file permission to make it executable which I did.
Code: Select all
#!/bin/bash
made no difference in Rox, but the batch file runs in terminal now.
Still no sleeping or hibernating, but it waits 60 seconds before returning to the command prompt.
Governor
Governor wrote: ↑Tue Dec 27, 2022 6:49 pmI did not see any instruction on run action, only the file permission to make it executable which I did.
Code: Select all
#!/bin/bash
made no difference in Rox, but the batch file runs in terminal now.
Still no sleeping or hibernating, but it waits 60 seconds before returning to the command prompt.
Hmm, do you have an extension like .txt or .bat on the end of the script filename? I don't usually have to set a run action for an executable script in Rox.
If it's running from the command line, you can test it and fiddle with it from there. Of course someone else needs to help you with that. I never hibernate or sleep my computers. When you do that they start to dream, and that's where the trouble begins.
geo_c
Old School Hipster, and Such
geo_c wrote: ↑Tue Dec 27, 2022 7:19 pmGovernor wrote: ↑Tue Dec 27, 2022 6:49 pmI did not see any instruction on run action, only the file permission to make it executable which I did.
Code: Select all
#!/bin/bash
made no difference in Rox, but the batch file runs in terminal now.
Still no sleeping or hibernating, but it waits 60 seconds before returning to the command prompt.
Hmm, do you have an extension like .txt or .bat on the end of the script filename? I don't usually have to set a run action for an executable script in Rox.
If it's running from the command line, you can test it and fiddle with it from there. Of course someone else needs to help you with that. I never hibernate or sleep my computers. When you do that they start to dream, and that's where the trouble begins.
You said it did not need an extension, but that is about the only way I have of identifying that it is a script I made myself, so I put a .bat extension on it. I have made hundreds of those.
Governor
Try taking it off.
geo_c
Old School Hipster, and Such
That is so weird! without the extension I don't get the "need to specify a run action" message, so I suppose it is working now from Rox, but I can't confirm it.
Another odd thing is that without the extension, I right click and get the option to "run in terminal". I don't get that option when there is an extension. Very weird.
It is totally crazy to me not to use an extension to identify that it is a batch file. I won't be able to keep track of or organize my files if I don't have extensions.
Governor
Governor wrote: ↑Tue Dec 27, 2022 7:41 pmThat is so weird! without the extension I don't get the "need to specify a run action" message, so I suppose it is working now from Rox, but I can't confirm it.
Another odd thing is that without the extension, I right click and get the option to "run in terminal". I don't get that option when there is an extension. Very weird.
It is totally crazy to me not to use an extension to identify that it is a batch file. I won't be able to keep track of or organize my files if I don't have extensions.
That's your windows mindset. Rox will color code all your files, so any executable will be a certain color. Not having an extension means you can name the script something like "hiber" so it's easy to type in a terminal and run. You have to make sure nothing else has the same name that's executable.
I think but I'm not sure, if you put the .sh extension it will run from Rox.
EDIT: @Jasper confirmed it. He knows more than me.
geo_c
Old School Hipster, and Such
I wouldn't. A batch file is not for linux.
You shouldn't identify a shell script as a batch file - it's very confusing. They are different. They have different syntax and are interpreted by different programs (wine has cmd.exe, hasn't it?). As Jasper already said, if you need an extension, use .sh
Governor wrote: ↑Tue Dec 27, 2022 2:42 pmI tried both versions. after adding:
Code: Select all
TZ=UTC0 rtcwake-FULL -d /dev/rtc0 -m on -s 60 --local
The code by itself:
Code: Select all
rtcwake-FULL -d /dev/rtc0 -m on -s 60 --local
is definitely doing something when entered at the command line in terminal. It waits 60 seconds and then the command line returns, but there is no countdown and no sleeping or hibernating. I like that I can interrupt it with Ctrl+C
Sorry, that talk about busybox only added to confusion. You don't need the busybox version of rtcwake. It's limited. Use rtcwake-FULL instead. rtcwake-FULL doesn't need --local
, TZ=UTC0
nor -d /dev/rtc0
-- all this is for making the busybox rtcwake work.
The -m on
is for testing. It does nothing, just waits. On my system, the mem
mode is probably the best. You can test it too or choose another one. This command in terminal should show you what modes are available on your system:
Code: Select all
rtcwake-FULL --list-modes
If mem is listed and you want to test it, then run this command:
Code: Select all
rtcwake-FULL -m mem -s 60
If the command works as expected and you want to put it into a shell script:
Click the folder icon named "file" on the desktop -- the rox window will appear showing the content of the /root directory.
Right-click somewhere on an empty white space inside the rox window and in the context menu select New -> Script
Give a script a descriptive name in the small "Create" window, for example, name it suspend.sh and click the create button. A new file will appear in the window. This file has the executable permission set already.
Right-click the script in the rox window and in the context menu select Open As Text. In the text editor add a line with the command and save the file.
Code: Select all
#!/bin/sh
rtcwake-FULL -m mem -s 60
Drag and drop the script onto the desktop -- this will create a launcher, an icon that you can click to start your script.
Burunduk wrote: ↑Wed Dec 28, 2022 1:12 amI wouldn't. A batch file is not for linux.
You shouldn't identify a shell script as a batch file - it's very confusing. They are different. They have different syntax and are interpreted by different programs (wine has cmd.exe, hasn't it?). As Jasper already said, if you need an extension, use .sh
The .sh extension works for me. I like it.
Governor wrote: ↑Tue Dec 27, 2022 2:42 pmI tried both versions. after adding:
Code: Select all
TZ=UTC0 rtcwake-FULL -d /dev/rtc0 -m on -s 60 --local
The code by itself:
Code: Select all
rtcwake-FULL -d /dev/rtc0 -m on -s 60 --local
is definitely doing something when entered at the command line in terminal. It waits 60 seconds and then the command line returns, but there is no countdown and no sleeping or hibernating. I like that I can interrupt it with Ctrl+C
Sorry, that talk about busybox only added to confusion. You don't need the busybox version of rtcwake. It's limited. Use rtcwake-FULL instead. rtcwake-FULL doesn't need
--local
,TZ=UTC0
nor-d /dev/rtc0
-- all this is for making the busybox rtcwake work.The
-m on
is for testing. It does nothing, just waits. On my system, themem
mode is probably the best. You can test it too or choose another one. This command in terminal should show you what modes are available on your system:Code: Select all
rtcwake-FULL --list-modes
If mem is listed and you want to test it, then run this command:
Code: Select all
rtcwake-FULL -m mem -s 60
If the command works as expected and you want to put it into a shell script:
Click the folder icon named "file" on the desktop -- the rox window will appear showing the content of the /root directory.
Right-click somewhere on an empty white space inside the rox window and in the context menu select New -> Script
Give a script a descriptive name in the small "Create" window, for example, name it suspend.sh and click the create button. A new file will appear in the window. This file has the executable permission set already.
Right-click the script in the rox window and in the context menu select Open As Text. In the text editor add a line with the command and save the file.
Code: Select all
#!/bin/sh rtcwake-FULL -m mem -s 60
Drag and drop the script onto the desktop -- this will create a launcher, an icon that you can click to start your script.
Great info. I will test some variations and see how they work.
Governor
That's not my words. I rarely add an extension to script names.
Now about your experiment. I continue here, the new thread is more about booting, I think.
Governor wrote: ↑Wed Dec 28, 2022 8:06 amI was trying the rtcwake-FULL command
Code: Select all
root# rtcwake-FULL -m mem -s 60
Unfortunately, the .sh file I made is now gone because it was on a virtual location created by the OS and that virtual location is now gone.
If I remember correctly, I tried:
Code: Select all
root# rtcwake-FULL -m disk -s 60
The screen went black. So far so good. Then the screen went strange with garbled colors with no distinct pattern, and then black again. I tried Ctrl+C which had no visible effect.
I opened my laptop and saw that the computer had re-booted itself and tried to boot my thumb drive, but failed.
Was it mem or disk? I've recommended to use mem
because the disk mode requires a swap file or partition bigger than ram to be present and enabled. Also, copying ram to disk takes more time.
You need a swap for -m disk
to work. Do you have it? But maybe you could delay your experiments until your booting problems are resolved. It will be possible then to boot without a save file or folder loaded so the experiments can't affect them. Also, the system shouldn't crash or reboot if there is no swap. As it's now obvious that fossapup can't put this computer into the state S4 (or maybe S3 too) correctly, there is little sense to repeat an attempt. The other systems/kernels may work though.