Page 1 of 4

swapfile manager

Posted: Tue 10 Aug 2010, 09:50
by jpeps
Wizard for creating swap files, with user entry for size and name/location. Default is 100M. Management includes swap on/off, and info button which displays free memory. Main window displays status and size of file.

Notes:
Version 1.2.1. Input KB; default set at 100M; edit path.


Version 2.0: Input Megs vs KB, set default at 512M, /mnt/home/swapfile. Make sure you have sufficient space, or change path/size.
Version3.0: Added Swappiness selection (decrease swappiness for computers with lots of ram)
Version 3.5 Added option to save settings; refresh labels to settings; friendlier window management, etc.


Version 4.0 Uses gtimer process widget (if installed)
Version 4.1 Better integration of gtimer
Version 4.2 Defaults to gtkdialog4, but reverts to gtkdialog3 if not present.
Added version name to work with pet uninstaller.
Version 4.5 Save settings to /etc/rc.d/init.d/swapmanager vs /etc/profile.local
Version 4.6 Remove annoyance test bug

Re: swapfile manager

Posted: Tue 10 Aug 2010, 15:35
by RetroTechGuy
jpeps wrote:Wizard for creating swap files, with user entry for size and name/location. Default is 100M. Management includes swap on/off, and info button which displays free memory. Main window displays status and size of file.
Excellent jpeps! I'll give it a try (just the tool we need for newbies!).

Posted: Tue 10 Aug 2010, 18:26
by abushcrafter
Some errors:

Code: Select all

# swapfilemanager
swapoff: can't stat '/mnt/sda2/swapfile': No such file or directory
EXIT="OK"
# swapfilemanager
swapon: can't stat '/mnt/sda2/swapfile': No such file or directory
EXIT="OK"
# swapfilemanager
dd: opening `/mnt/sda1/swapfile': No such file or directory
/mnt/sda1/swapfile: No such file or directory
FILE="/mnt/sda1/swapfile"
KB="102400"
EXIT="OK"
#
Can't switch swap off. Does not remember swap file path.

Good .desktop file:

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=Swapfile Manager
Icon=woodendrive.xpm
Comment=
Exec=swapfilemanager
Terminal=false
Type=Application
Categories=X-SystemMemory

Posted: Tue 10 Aug 2010, 21:49
by jpeps
Thanks for the the support and testing. Uploaded Ver 1.1, which should
fix late night coding bloopers.

Edit: Fixed the menu.....

Posted: Wed 11 Aug 2010, 12:59
by abushcrafter
Haven't found any new bugs. Seems that this is a new useful app :). Now for a feature request :). Can you please add the feature for switching on and off a swap partition. Thanks for you work so far.

Posted: Wed 11 Aug 2010, 15:03
by jpeps
abushcrafter wrote:Haven't found any new bugs. Seems that this is a new useful app :). Now for a feature request :). Can you please add the feature for switching on and off a swap partition. Thanks for you work so far.
swapon/swapoff -a ?? (I don't have one to test). My original idea was to just handle swap files.

Posted: Wed 11 Aug 2010, 15:20
by abushcrafter
jpeps wrote:
abushcrafter wrote:Haven't found any new bugs. Seems that this is a new useful app :). Now for a feature request :). Can you please add the feature for switching on and off a swap partition. Thanks for you work so far.
swapon/swapoff -a ?? (I don't have one to test). My original idea was to just handle swap files.
Ok, never mined it's not a must have. It's your app and I will let that be. I also don't know how to swap on/off just a swap partition any way.

Thanks for the swapon command. Been meaning to find out what command to use to switch swap on.

Now to add this to my puplet, A Powerful Puppy (appup or app).
[Edit] Here is a better menu category: "X-SystemMemory". You also haven't done the "pet.specs" part of the PET properly.

Posted: Thu 12 Aug 2010, 05:43
by jpeps
abushcrafter wrote: [Edit] Here is a better menu category: "X-SystemMemory". You also haven't done the "pet.specs" part of the PET properly.
I don't have that category in stardust, and don't see it in petspec either.


For some reason, dir2pet bypassed the petspec gui and I got an empty pet.specs file (although package uninstalls OK). However, I see swapfilemanager appended to .user-installed-packages:

Code: Select all

  swapfilemanager||||System|||swapfilemanager.pet|||
Here's the output if I run petspec manually:

Code: Select all

 swapfilemanager-1.2|swapfilemanager|1.2||System|4.0K|/usr/local/bin|swapfilemanger.pet||Swap File Manger||||
edit: Here's the dir2pet error when attempting to load GUI window:

Code: Select all

** ERROR **: gtkdialog: Error in line 16, near token '</default>': syntax error

aborting...
Strange....GUI loads fine with "petspec"

NOTE: dir2pet issue moved to :
http://murga-linux.com/puppy/viewtopic.php?t=52033

Posted: Thu 12 Aug 2010, 16:15
by abushcrafter
jpeps wrote:
abushcrafter wrote: [Edit] Here is a better menu category: "X-SystemMemory". You also haven't done the "pet.specs" part of the PET properly.
I don't have that category in stardust, and don't see it in petspec either.
You do. A list of category's is at "/etc/xdg/menus/hierarchy".
jpeps wrote:For some reason, dir2pet bypassed the petspec gui and I got an empty pet.specs file (although package uninstalls OK). However, I see swapfilemanager appended to .user-installed-packages:

Code: Select all

  swapfilemanager||||System|||swapfilemanager.pet|||
Here's the output if I run petspec manually:

Code: Select all

 swapfilemanager-1.2|swapfilemanager|1.2||System|4.0K|/usr/local/bin|swapfilemanger.pet||Swap File Manger||||
edit: Here's the dir2pet error when attempting to load GUI window:

Code: Select all

** ERROR **: gtkdialog: Error in line 16, near token '</default>': syntax error

aborting...
Strange....GUI loads fine with "petspec"
I have had that error before. Not sure what I did to fix it. I think I launched the Package Database Entry Creator (petspec). The menu entry is "create pkg db entry" in the "Utility" sub menu btw.I put the generated "pet.specs" into my PET and then the dir2pet script worked. It might have been a newer version of petspec which has a fix for this bug, I think. Which Is the one I have been using currently.

Posted: Thu 12 Aug 2010, 16:40
by jpeps
Abushcrafer: Let's move the dir2pet issue over to
http://murga-linux.com/puppy/viewtopic.php?t=52033

I ran the updated version with same issue, and posted petspec result above. Thanks!

Posted: Thu 12 Aug 2010, 16:44
by abushcrafter
jpeps wrote:Abushcrafer: Let's move the dir2pet issue over to
http://murga-linux.com/puppy/viewtopic.php?t=52033

I ran the updated version with same issue, and posted petspec result above. Thanks!
Ok. Just saw you post before you posted here :wink:.

Posted: Thu 12 Aug 2010, 20:15
by jpeps
Uploaded version 1.2.1 with fixed pet.specs and category as suggest by abushcrafter (Thanks!)

abushcrafter: I had to run dir2pet with manually generated petspec file inside to create proper pet.spec.

Posted: Thu 12 Aug 2010, 21:39
by abushcrafter
jpeps wrote:abushcrafter: I had to run dir2pet with manually generated petspec file inside to create proper pet.spec.
That was it.

Posted: Mon 30 Aug 2010, 03:38
by jemimah
I've added this to Puppeee and Fluppy. Thanks!

Posted: Mon 30 Aug 2010, 13:15
by sc0ttman
How does this differ from this one - http://www.murga-linux.com/puppy/viewtopic.php?t=56431?

Everyone seems a lot more interested in this!

Posted: Tue 31 Aug 2010, 05:43
by jemimah
I think it's because I'm not sure why I need a scratch file, but the purpose of a swap file is more obvious.

Posted: Tue 31 Aug 2010, 12:46
by sc0ttman
jemimah wrote:I think it's because I'm not sure why I need a scratch file, but the purpose of a swap file is more obvious.
Isn't is just semantics? Don't they create the same kind of file?

Posted: Tue 31 Aug 2010, 12:50
by jemimah
A swap file adds virtual memory. A scratch file is like an additional save file, yes?

Posted: Tue 31 Aug 2010, 12:53
by sc0ttman
jemimah wrote:A swap file adds virtual memory. A scratch file is like an additional save file, yes?
Aha.. that must be it. Very succinct.

Posted: Tue 31 Aug 2010, 15:56
by RetroTechGuy
jemimah wrote:A swap file adds virtual memory. A scratch file is like an additional save file, yes?
The one thing I didn't like about the tool was that it, by default, did not name the file pupswap.swp (IIRC that's the default pup swap filename).

Also, I think the default size was a little strange (did I miss read it, or was it 10 MB?) -- and it would probably be better if it used MB as the size measurement (I doubt anyone wants to fine-tune the swap size to kilobytes, or bytes...).

I'm guessing that if someone is adding a swap file, they probably want 256MB or 512 MB, so I would be inclined to make one of those sizes the "default" choice (the user can still change the size manually).

Otherwise, the tool seemed to work fine (a couple weeks back, I converted another Windows user to Puppy -- too little RAM for Windows to run properly, but Puppy did just fine, with a swap file :D )