Author Topic: Priority Script  (Read 510 times)

0 Members and 1 Guest are viewing this topic.

Offline antox

  • Ferengi
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16798
Priority Script
« on: May 11, 2010, 01:09:22 PM »

Priority Script

v1.1

Description:

This Script is written by buyukbang and inspired from the script made By MalMen.
PriorityManager automatically changes the priorities of the processes to give optimal performance for the menu being used.
I tested all processes one by one, decided their effects on the performance of all modules and wrote a bug-free (hopefully)
priority manager script.




Code: You are not allowed to view links. Register or Login
PriorityManager automatically changes the priorities of the processes to give optimal performance for the menu being used. I found huge bugs on both MalMen's and massimo1167's scripts and decided to write a new one. I tested all processes one by one, decided their effects on the performance of all modules and wrote a bug-free (hopefully) priority manager script. Here are the details:

Fixed: All process priorities updated according to the results of my long tests. Mediaplayer performance, IP TV, Recording, ECM Time (for EMUs) are optimized.

Fixed: Old scripts use &quot;snice +XX&quot; command to give processes positive nice values (lower priority). But this command does not guarantee to decrease the priority and system sometimes ignore this command. You can check old scripts by top command while changing menu modes. &quot;<&quot; sign means negative nice value and high priority, &quot;N&quot; sign means positive nice value and low priority. After a few times changing the menu modes everything has &quot;<&quot; sign and this is really nonfunctional situation. To fix this problem I used &quot;snice STOP&quot; which cannot be ignored by the system.

Fixed: massimo1167's script is not compatible with the option &quot;Always Start in TV Mode&quot; and this causes totally wrong prioritization. This is fixed.

Fixed: Old scripts block firmware upgrades and upgrade process sticks at &quot;Extracting&quot;. S99PriorityManager fixes this issue and fully compatible Opensat upgrades. Just wait 60 seconds (maximum) at &quot;Extracting&quot;, upgrade process will continue.

Added: ftp,samba,telnet prioritization in sleep mode. I suggest you to transfer your files with FTP during sleep mode prioritization. This is the fastest method.

Added: Photo prioritization

Added: Browser prioritization

Added: RSS prioritization

Added: Use this command to stop the script (does not work in old scripts): /DISK2/etc/start.d/S99PriorityManager.sh stop

Added: Use this command to restart the script (does not work in old scripts): use command /DISK2/etc/start.d/S99PriorityManager.sh stop restart

Added: Logging. Use this command to see log file: tail -f S99PriorityManager_IsRunning


Important Notes:

- Put this script under &quot;/DISK2/etc/start.d&quot;, use command &quot;chmod 755 /DISK2/etc/start.d/S99PriorityManager.sh&quot;, finally restart the box.

- Scripts works in a loop with 60 seconds sleep times. So wait max 60 seconds for prioritization. You can decrease 60 seconds if you want, but values below 10 will cause performance degradation.

- Mediaplayer prioritization will start after playing a movie file. File browser will not be prioritized since there is no need and this is logged as &quot;CURRENT_MENU=UNKNOWN&quot;. This is the same as with the sleep mode prioritization and so ftp, samba, telnet will have higher priority.

- A looped script in /DISK2/etc/start.d/ will block the other scripts with a higher heading value. So use only looped script (and this is it). This is the reason why I used &quot;99&quot; in the script name. This will not block any script with two digit but will block scripts with higher values as heading value.

v1.1
-----
RSS and Browser components stay in memory after first usage. Added support for automatically killing RSS and Browser

Offline antox

  • Ferengi
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16798
Re: Priority Script
« Reply #1 on: May 14, 2010, 06:19:46 PM »

Priority Script

v1.2

14.05.2010

################################# ###################
# Description:
#
# This Script is written by buyukbang and inspired from the script made By MalMen.
# Special thanks to Smudger for all tests for the all information, tests and power measurements!
#
# 1. S99PriorityManager automatically changes the priorities of the processes to give optimal performance for the menu being used. I tested
# all processes one by one, decided their effects on the performance of all modules and wrote a bug-free (hopefully) script.
#
# 2. S99PriorityManager provides power saving ! Smudger's power measurements show that S99PriorityManager decrease power consumption of the
# box from 25W to 23W while watching an SD channel and from 28W to 24W while watching an HD channel.
#
#
################################# ###################
# User Defined Parameters :
#
# MODE : IF YOU WANT TO RUN THIS SCRIPT ON A BOX BEING USED AS A CAM SERVER CHANGE BELOW LINE TO MODE=SERVER THEN SAVE THE SCRIPT.
MODE=CLIENT
#
################################# ###################
# History:
#
# v1.2
# -----
# Fixed : Sometimes CRTVCore collects all CPU power and this slows down everything. So I decreased priority of CRTVCore.
# Fixed : Fixed a bug in restart command ( /DISK2/etc/start.d/S99PriorityManager.sh restart )
# Improved : All process priorities fine tuned.
# Improved : Better menu detection.
# Improved : Better sleep mode detection.
# Modified : Loop sleep time decreased from 60 seconds to 30 seconds.
# Added : azepgmgr support to protect TV/Media applications from the glitches caused by its initial process. (Thanks to Smudger!)
# Added : Client/Server mode switch parameter for those who want to this script on a box being used as a CAM server.
# Added : Audio menu prioritization.
# Added : Settings menu prioritization.
# Added : Plugins menu prioritization.
# Added : Cheops EMU prioritization.
# Added : SBox EMU prioritization.
#
# v1.1
# -----
# Added : RSS and Browser components stay in memory after first usage. Added support for automatically killing RSS and Browser
# components when using other menu.
#
# v1.0
# -----
# Fixed : All process priorities updated according to the results of my long tests. Mediaplayer performance, IP TV, Recording,
# ECM Time (for EMUs) are optimized.
# Fixed : Old scripts use "snice +XX" command to give processes positive nice values (lower priority). But this command does
# not guarantee to decrease the priority and system sometimes ignore this command. You can check old scripts by top command
# while changing menu modes. "<" sign means negative nice value and high priority, "N" sign means positive nice value and
# low priority. After a few times changing the menu modes everything has "<" sign and this is really nonfunctional situation.
# To fix this problem I used "snice STOP" which cannot be ignored by the system.
# Fixed : massimo1167's script is not compatible with the option "Always Start in TV Mode" and this causes totally wrong
# prioritization. This is fixed.
# Fixed : Old scripts block firmware upgrades and upgrade process sticks at "Extracting". S99PriorityManager fixes this issue and
# fully compatible Opensat upgrades. Just wait 45 seconds at "Extracting", then upgrade process will continue.
# Added : ftp,samba,telnet prioritization in sleep mode. I suggest you to transfer your files with FTP during sleep mode prioritization.
# This is the fasted method.
# Added : Photo menu prioritization.
# Added : Browser menu prioritization.
# Added : RSS menu prioritization.
# Added : Use this command to stop the script (does not work in old scripts) : /DISK2/etc/start.d/S99PriorityManager.sh stop
# Added : Use this command to restart the script (does not work in old scripts) : /DISK2/etc/start.d/S99PriorityManager.sh restart
# Added : Logging. Use this command to see log file : tail -f /tmp/S99PriorityManager_IsRunning
#
################################# ###################
# Intallation:
#
# 1. Check "User Defined Parameters" and if needed edit parameters then save the scipt.
# 2. Put this script under "/DISK2/etc/start.d", use following commands in TELNET with below order.
# 3. chmod 755 /DISK2/etc/start.d/S99PriorityManager.sh
# 4. If you edited and saved the script use this command: dos2unix /DISK2/etc/start.d/S99PriorityManager.sh
# 5. After the first run of the script standby.sh and wakeup.sh scripts will be created under /DISK2/etc . These scripts will help to main
# script for the decision of the sleep mode by creating and deleting a file ( /tmp/S99PriorityManager_Sleep ) If you have already
# standby.sh and wakeup.sh in /DISK2/etc you must manually add below commands to scripts before running S99PriorityManager.sh :
# echo 0 > /tmp/S99PriorityManager_Sleep ==> to standby.sh
# rm /tmp/S99PriorityManager_Sleep ==> to wakeup.sh
# 6. /DISK2/etc/start.d/S99PriorityManager.sh start (After this command standby.sh and wakeup.sh will be created under /DISK2/etc)
# 7. Restart the box. 30 seconds after restarting use below command to check if the script is working.
# 8. tail -f /tmp/S99PriorityManager_IsRunning
#
################################# ###################
# Important Notes:
#
# - Scripts works in a loop with 30 seconds sleep times. So wait max 30 seconds for prioritization. You can decrease this to 15-20 seconds
# if you want, but values below 10 may cause a small performance loss.
#
# - A looped script in /DISK2/etc/start.d/ will block the other scripts with a higher heading value. So use only one looped script (and
# this is it). This is the reason why I used "99" in the script name. This will not block any script with two digit but will block scripts
# with higher values as heading value.
#
################################# ###################

Offline antox

  • Ferengi
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16798
Re: Priority Script
« Reply #2 on: May 23, 2010, 04:40:54 PM »
Priority Script v1.3



Priority Script v1.3

BY BUYUKBANG

I'm very tired of all coding, testing and bug fixing process, I can have a rest now.

PLEASE READ "INSTALLATION" AND "IMPORTANT NOTES" SECTIONS BEFORE ASKING OR COMPLAINING ABOUT SOMETHING!, THANKS....


DESCRIPTION:
------------------------------------------------------------------------------------------
This plugin is written by BUYUKBANG to improve total performance of Azbox HD !
Here is the short list of jobs Priority Manager does:

1. Priority Manager automatically changes the priorities of the processes to give optimal
performance for the menu being used. I tested all processes one by one, decided their
effects on the performance of all modules and prepared a bug-free (hopefully) and complex
logic to cover all possible usage cases.

2. Priority Manager provides power saving! Smudger's power measurements show that
Priority Manager decrease power consumption of the box from 25W to 23W while watching an
SD channel and from 28W to 24W while watching an HD channel.

3. Priority Manager optionally automatically mounts CIF and NFS shares when remote server
is online and automatically unmounts CIF AND NFS shares when remote server is offline, so
protects file manager from freezes when remote goes offline after the shares mounted.

4. Priority Manager optionally creates swap file on your HDD/Flash disk which will help
RAM by caching some part of the memory. Priority Manager not only supports creating swap
file on internal HDD or usb HDD/Flash disk connected before Azbox boots, it also supports
creating swap file on usb HDD/Flash disk connected after Azbox boots by continuously
checking for new USB devices.

5. Priority Manager can execute user selected programs after going into SLEEP mode and
the kill them after return from SLEEP mode. By using this feature running resource
intensive programs like transmission, aMule, azepgmgr in only SLEEP mode will be
automatically managed without user intervention.

6. Priority Manager increases internal storage (DOM) speed speed up to 20% by changing
its working parameters.

7. Priority Manager provides "Deep Sleep Mode" which automatically kills all unnecessary
applications and improve downloading speed when box goes to sleep mode.


SPECIAL THANKS TO:
------------------------------------------------------------------------------------------
Smudger for the all information, tests and power measurements, his tests killed the bugs!

Kanber Kav for his permission for the usage and modification of his Multicas Info plugin
and for the idea of increasing internal storage (DOM) speed!


HISTORY:
------------------------------------------------------------------------------------------
v1.3
-----
NEW : Packed the script as a plugin. You can look at the script logs, activate,
deactivate, restart the script simply from Plugins Menu without having to use TELNET.
Special thanks to Kanber Kav for his permission for the usage and modification of his
Multicas Info plugin!

NEW : Increasing internal storage (DOM) speed up to 20% by changing its working
parameters! (Thanks to Kanber Kav for the idea!)

NEW : Full automated cleanup mechanism: After deleting this plugin from Plugins Menu,
Priority Manager will be deactivated and process will be stopped, all installed files and
log file will be deleted, all process priorities will be set to their default values. No
reboot or user intervention needed!

NEW : Reserved programs are now supported. When a scheduled recording starts, TV
prioritization will be applied until it ends.

NEW : CIF mount support for those who want want to mount CIF shares of your network to
Azbox. (auto-mounts shares when the file server is online, auto-unmounts share when the
file server is offline)

NEW : NFS mount support for those who want want to mount NFS shares of your network to
Azbox. (auto-mounts shares when the file server is online, auto-unmounts share when the
file server is offline)

NEW : Swap file support for Azbox. You can activate this option so that to Priority
Manager creates swap file on your HDD or Flash disk which will help RAM by caching some
part of the memory. Swap usage file helps large file operations like recording.

NEW : "Deep Sleep" option. You can activate this option if you want to kill all
unnecessary applications when box goes to sleep mode to improve downloading speed. There
are some side effects of deep sleep. For more information please read DEEP_SLEEP section
of settings.txt .

NEW : Automatic management of execution and killing of sleep mode programs. Priority
Manager can execute user selected programs after going into SLEEP mode and the kill them
after return from SLEEP mode with the new feature. For more information please read
PROGRAM section of settings.txt .

NEW : CCcam EMU prioritization. (Thanks to Smudger for the information!)

NEW : NewCS EMU prioritization. (Thanks to Smudger for the information!)

NEW : Transmission (torrent client) sleep mode prioritization.

NEW : aMule (eD2K client) sleep mode prioritization.

NEW : Verbose log generation for debugging added. Please read "IMPORTANT NOTES - 4" for more information.

NEW : Better TV recording and channel switch speed.

NEW : Better performance for some process priorities.

NEW : All settings are moved from script file to a separate file : settings.txt

FIX : "CANCEL" option in sleep menu is now detected as it should be.

v1.2
-----
NEW : azepgmgr support to protect TV/Media applications from the glitches caused by its
initial process. (Thanks to Smudger for all tests and information!)

NEW : Client/Server mode switch parameter for those who want to this script on a box
being used as a CAM server.

NEW : Audio menu prioritization.

NEW : Settings menu prioritization.

NEW : Plugins menu prioritization.

NEW : Cheops EMU prioritization.

NEW : SBox EMU prioritization.

NEW : All process priorities fine tuned.

NEW : Better menu detection.

NEW : Better sleep mode detection.

NEW : Loop sleep time decreased from 60 seconds to 30 seconds.

FIX : Sometimes CRTVCore collects all CPU power and this slows down everything. So I
decreased priority of CRTVCore.

FIX : Fixed a bug in restart: /DISK2/etc/start.d/S99PriorityManager.sh restart

v1.1
-----
NEW : RSS and Browser components stay in memory after first usage. Added support for
automatically killing RSS and Browser components when using other menu.

v1.0
-----
NEW : All process priorities updated according to the results of my long tests. IP TV,
Mediaplayer, Recording, ECM Time (for EMUs) performances are optimized.

NEW : Old scripts use "snice +XX" command to give processes positive nice values (lower
priority). But this command does not guarantee to decrease the priority and system
sometimes ignore this command. You can check old scripts by top command while changing
menu modes. "<" sign means negative nice value and high priority, "N" sign means positive
nice value and low priority. After a few times changing the menu modes everything has "<"
sign and this is really nonfunctional situation. To fix this problem I used "snice STOP"
which cannot be ignored by the system.

NEW : massimo1167's script is not compatible with the option "Always Start in TV Mode"
and this causes totally wrong prioritization. This is fixed.

NEW : Old scripts block firmware upgrades and upgrade process sticks at "Extracting".
Priority Manager fixes this issue and fully compatible Opensat upgrades. Just wait 45
seconds at "Extracting", then upgrade process will continue.

NEW : ftp,samba,telnet prioritization in sleep mode. I suggest you to transfer your files
with FTP during sleep mode prioritization. This is the fasted method.

NEW : Photo menu prioritization.

NEW : Browser menu prioritization.

NEW : RSS menu prioritization.

NEW : Use this command to stop the script (does not work in old scripts):
/DISK2/etc/start.d/S99PriorityManager.sh stop
NEW : Use this command to restart the script (does not work in old scripts):
/DISK2/etc/start.d/S99PriorityManager.sh restart

NEW : Logging. Use this command to see log file:
tail -n100 -f /tmp/PriorityManager_IsRunning


INSTALLATION:
------------------------------------------------------------------------------------------
1. Extract PriorityManager.plugin and plugins.lst files from the archive file.

2. Copy PriorityManager.plugin and plugins.lst to USB or simply transfer them by FTP to
/tmp folder of your Azbox.

3. Enter Plugins menu, press Red Button on remote controller to add plugin. If you're
using USB select to install it from USB, or if you transferred files to /tmp folder
install it from tmp folder.

4. Check user defined parameters in /PLUGINS/PriorityManager/settings.txt and edit
parameters if you want, save the file.

5. Activate plugin from the plugins menu: PLUGINS-->PriorityManager-->Activate/Reactivate

6. After the first run of the script standby.sh and wakeup.sh scripts will be created
under /DISK2/etc . These scripts will help to main script for the decision of the sleep
mode by creating and deleting a file ( /tmp/PriorityManager_Sleep ) If you have already
standby.sh and wakeup.sh in /DISK2/etc, they will be backed up by installation process
in the same directory. Then you may want to manually add below commands to scripts
before running Priority Manager:
echo 0 > /tmp/PriorityManager_Sleep = to standby.sh
rm /tmp/PriorityManager_Sleep = to wakeup.sh


IMPORTANT NOTES:
------------------------------------------------------------------------------------------
1. Priority Manager script works in a loop with 30 seconds sleep times. So wait max 30
seconds for prioritization. You can decrease this to 15-20 secs if you want, but values
below 10 may cause a small performance loss.

2. A looped script in /DISK2/etc/start.d/ will block the other scripts with a higher
heading value. So do not use any looped script. This is the reason why I used "99" in the
script name. This will not block any script with two digits but will block scripts with
higher values as heading value.

3. Please do not use any folder in HDD to mount shares. This will cause HDD not to sleep
because of continuous folder checks by Priority Manager. Even without Priority Manager,
it's not recommended, since share access always triggers HDD. Instead I would recommend
you to use folders in internal storage (DOM). If you need to access this mounts directly
from Menus (under main directories of Video, Music, Picture), you can use symlinks
created under HDD pointing mount folders in DOM.

4. If you have any problems with Priority Manager, change VERBOSE_MODE=1 in settings.txt
and reactivate Priority Manager from PLUGINS-->PriorityManager-->Activate/Reactivate.
This will create a verbose log file /PLUGINS/PriorityManager/PriorityManager_Verbose_Log
Collect data with this option set to 1, without stopping, restarting, reactivating and
deactivating Priority Manager, because all this operations will delete all old log files.
Then send an e-mail to author (you can find my e-mail adress in readme.txt) containing
PriorityManager_Verbose_Log with the approximate time that problem occured. Don't forget
to reset VERBOSE_MODE=0 and restart priority manager or logfile size will continuo
usly
increase which may cause internal storage (DOM) to run out of disk space.

Offline antox

  • Ferengi
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16798
Re: Priority Script
« Reply #3 on: July 05, 2010, 07:06:32 AM »
Priority Manager V1.6 BY BUYUKBANG

v1.6
-----
NEU: Feintuning fĂĽr den Kanal Schaltzeiten. (Danke an Zeini fĂĽr die Tests)

NEU: Setzen Sie alle System-Passwörter aus Benutzeroberfläche.

NEU: Automatische Korrektur PriorityManagerSettings.txt Format againist versehentlich UNIX
wird im DOS-Format durch Benutzer gespeichert.

NEU: Priority Management Feature kann ein-und ausschalten von Benutzeroberfläche oder mal direkt
von PriorityManagerSettings.txt.

NEU: DYNAMIC_SLEEP, MAJOR_SLEEP_TIME, MINOR_SLEEP_TIME Parameter hinzugefügt werden. Sie können
Veränderungen dieser Parameter in PriorityManagerSettings.txt wenn Sie nicht zufrieden sind (oder
Probleme mit) Priority Management Feature. Dies gibt Ihnen mehr Kontrolle über die Priorität
Management.

NEU: DOM Speed Increading Funktion kann ein-und ausschalten von Benutzeroberfläche oder mal direkt
von PriorityManagerSettings.txt.

Neu: UnterstĂĽtzung fĂĽr die Montage CIF und NFS-Freigaben der gleichen Datei-Server zur gleichen Zeit.

UPDATE: Mit einem Klick auf eine Schaltfläche in der Benutzeroberfläche zeigt manchmal leer Ausgang.

UPDATE: Falsche Dokumentation von selbst, dass damit CRON Feature erfordert ermöglicht BusyBox
Feature. In der Tat, / plugins / PriorityManager / busybox wird direkt von Priority Manager aufgerufen,
Also, wenn Sie möchten, können Sie deaktivieren BusyBox-Funktion während der Verwendung CRON-Funktion.

Offline antox

  • Ferengi
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16798
Re: Priority Script
« Reply #4 on: July 19, 2010, 08:11:46 AM »
Priority_Manager_v1.7


v1.7
-----
NEW: Added KILL_TV_EMU and WAIT_SECONDS_BEFORE_KILL options to PriorityManagerSettings.txt.
When KILL_TV_EMU is activated, all TV and EMU applications are automatically killed after
switching to movie, rss or browser menus. with this feature, your box will have more free
system resources (both processing power -CPU- and RAM) for playing higher bitrate movies
or browsing the internet.

NEW: Added "Movie & Browser" button to user interface. If you don't want to use "Auto
Kill TV-EMU" feature activated by KILL_TV_EMU option, you can use "Movie & Browser"
button to kill TV and EMU applications before watching a very high bit rate movie file.
TV and EMU applications will be automatically restarted after swithcing back to TV menu.

NEW: "Hidden Channel List" button now doesn't need to reboot the box.

NEW: "Default Channel List" added. So you don't need to reboot the box to activate default
channel list.

NEW: Azbox settings file (selene.conf) is included in both "Default Channel List" and
"Hidden Channel List" packs. So you can define and use different settings (ie. volume,
parental lock setting, last switched channel, etc..) for each channel lists.

NEW: OSCAM EMU prioritization. (Thanks to Alex-1 for the information!)

NEW: OpenVPN prioritization. (Thanks to banditus for the information!)

NEW: Decreased CPU usage of PriorityManager.sh (Its priority is decreased and default
MINOR_SLEEP_TIME value is set to 3.)

FIX: HDD not sleeps when reserved programs are waiting to be recorded. Previous fix made
in v1.4 was not enogh. But this time the problem is completely fixed (Thanks to Alex-1
for the bug report and fix tests!)

You are not allowed to view links. Register or Login