Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **************************************************************************************
- COMMON
- **********************
- In this system a generous pseudo-user, 'common', provides all other users with environment, services, software and data.
- 'common's $HOME is $COMMON_DIR (currently /home/common).
- **********************
- Environment
- **********
- 'common's services support the following filesystems:
- MainLinux HD Main partitions: '/', '/home', '/home/common/Store' Internal HD
- EmergencyLinux HD Main partitions: '/', '/home', '/home/common/Store' Internal HD
- ExternalEmergencyLinux HD Main partitions: '/', '/home', '/home/common/Store' External HD
- # All HDs are interchangeable, see '$COMMON_DIR/SystemDocs/root_This_PC/Partitions.*.txt' for details.
- # 'grub's menu will let user choose which drive to boot from.
- # Link '$SYSTEMLINKS_DIR/DriveSpecific' determines how a HD is used: 'MainLinux', 'EmergencyLinux' or 'ExternalEmergencyLinux'.
- # The number of available/used HDs is specified in file '$SYSTEMLINKS_TO_LINK_DIR/CommonSettings' (see below).
- One of the main advantages of Linux is that it is always changing (improving), unfortunately, if you write software
- that relies on its 'evolving' features, it is also a disadvantage. 'common' needs the Linux distro but tries
- to depend on it as little as possible (just bash and core-utils commands). The only 'common's structure which
- is hardware and distro dependent is the directory:
- $SYSTEMLINKS_DIR (currently '/root/SystemLinks'). With subdirectories:
- $SYSTEMLINKS_TO_LINK_DIR
- $SYSTEMLINKS_STORE_DIR
- $SYSTEMLINKS_STORE_DIR/Alternatives
- Bash script '$SYSTEMLINKS_STORE_DIR/SystemLinks' (Link in '/root/bin') inserts/replaces/moves links in the Linux distro
- to adapt it to 'common's requirements.
- Running 'SystemLinks' modifies the Linux distro.
- Running 'SystemLinks -unlink' reverts the Linux distro to its original condition.
- 'SystemLinks' actions:
- Links alternatives (as specified in file '$SYSTEMLINKS_TO_LINK_DIR/CommonSettings'), in '$SYSTEMLINKS_STORE_DIR/Alternatives',
- to $SYSTEMLINKS_STORE_DIR.
- Reads each file in $SYSTEMLINKS_TO_LINK_DIR and links the file, or the corresponding file/directory in $SYSTEMLINKS_STORE_DIR
- (specified in file), to a Linux distro's directory (or directories) (specified in file).
- 'SystemLinks -unlink' actions:
- Removes links that didn't exist originally in distro.
- Changes links that replaced Linux distro items so that they now point to the original items.
- 'SystemLinks' runs weekly (see 'CommonCron' service, below) and sends internal mail to 'root' if it finds any changes in the
- links it created (I.E. when a distro update deletes/overwrites/renames a 'SystemLinks' link).
- Typical 'SystemLinks' output: {
- SystemLinks: Alternative 'This_System.A.Linux-1' already linked to 'This_System'.
- SystemLinks: Alternative 'modules.A.Linux-1' already linked to 'modules'.
- SystemLinks: 'local'(Store) already linked to '/usr'.
- SystemLinks: 'This_System'(Store) already linked to '/home/common'.
- SystemLinks: '07_custom'(Store) already linked to '/etc/grub.d'.
- SystemLinks: '20-nvidia.conf'(Store) already linked to '/etc/X11/Xsession.d'.
- SystemLinks: 'after_boot.local'(Store) already linked to '/etc'.
- SystemLinks: 'before_halt.local'(Store) already linked to '/etc'.
- SystemLinks: 'blacklist.conf'(Store) already linked to '/etc/modprobe.d'.
- SystemLinks: 'CommonCronTasks'(Store) already linked to '/home/common'.
- SystemLinks: 'CommonSettings'(Store) already linked to '/home/common/etc'.
- SystemLinks: 'CommonStartUpShutdown.service'(Store) already linked to '/etc/systemd/system/local-fs.target.wants'.
- SystemLinks: 'CommonStartUpShutdown.service'(Store) already linked to '/etc/systemd/system'.
- SystemLinks: 'data'(Store) already linked to '/usr/share/stardict'.
- SystemLinks: 'dic'(Store) already linked to '/usr/share/stardict'.
- SystemLinks: 'DiskErrorsWarning'(Store) already linked to '/etc'.
- SystemLinks: 'DmSession_CommonCleanup'(Store) already linked to '/etc'.
- SystemLinks: 'DmSession_CommonSetup'(Store) already linked to '/etc'.
- SystemLinks: 'fstab'(Store) already linked to '/etc'.
- SystemLinks: 'fstab.EmergencyLinux'(Store) already linked to '/etc'.
- SystemLinks: 'fstab.ExtEmergencyLinux'(Store) already linked to '/etc'.
- SystemLinks: 'fstab.MainLinux'(Store) already linked to '/etc'.
- SystemLinks: 'GraphicalSessionAutostart.desktop'(Store) already linked to '/etc/xdg/autostart'.
- SystemLinks: 'grub'(Store) already linked to '/etc/default'.
- SystemLinks: 'lightdm.conf'(Store) already linked to '/etc/lightdm'.
- SystemLinks: 'locale'(Store) already linked to '/etc/default'.
- SystemLinks: 'modules'(Store) already linked to '/etc'.
- SystemLinks: 'profile.local.sh'(Store) already linked to '/etc/profile.d'.
- SystemLinks: 'slick-greeter.conf'(Store) already linked to '/etc/lightdm'.
- SystemLinks: 'smartd.conf'(Store) already linked to '/etc'.
- SystemLinks: 'smartmontools'(Store) already linked to '/etc/default'.
- SystemLinks: 'treedict'(Store) already linked to '/usr/share/stardict'.
- SystemLinks: 'users.conf'(Store) already linked to '/etc/lightdm'.
- }
- Some effects of 'SystemLinks' links:
- -Directory '$COMMON_DIR/UserLocal', in '/home' partition, linked to '/user/local', in '/' partition.
- ls -l $SYSTEMLINKS_STORE_DIR/local
- lrwxrwxrwx 1 root root /root/SystemLinks/Store/local -> /home/common/UserLocal
- ls -l /usr/local
- lrwxrwxrwx 1 root root /usr/local -> /root/SystemLinks/Store/local
- # '/user/local' provides, among other things, distro independent binaries E.G.: java.
- -Bash script 'profile.local.sh' runs (sourced by '/etc/profile') whenever there is a (GUI or otherwise) login,
- providing users with many environment variables, setting PATH, etc.
- ls -l /etc/profile.d/profile.local.sh
- lrwxrwxrwx 1 root root /etc/profile.d/profile.local.sh -> /root/SystemLinks/ToLink/profile.local.sh
- # Many environment variables have a path as value (if path exists). That, together with bash script 'DefaultApplications'
- # (see below), provides an EXTRA ABSTRACTION LAYER: Everywhere (scripts, applications, MainMenu...) paths are given as
- # environment variables and application names as 'Default*'. E.G. 'DefaultFileSystemBrowser $COMMON_JAVA_JARS_DIR'.
- #
- # If subdirectory '/home/common/CommonJava/CommonJavaJars' is moved to '/home/common/Misc/Jars' it is only necessary to change
- # the value of environment variable $COMMON_JAVA_JARS_DIR (by editing 'profile.local.sh'). If the distro's default filesystem
- # browser changes from 'nautilus' to 'nemo' it is only necessary to edit 'DefaultApplications' script for everything to work
- # correctly. Filetypes are also associated to 'Default*' application names ('$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps').
- #
- # The above scheme means that 'Default*' applications/commands are always run by invoking bash script 'DefaultApplications'. That
- # allows individual setting of 'Default*' application/command run conditions: Default options, Allow/don't_allow passing of arguments,
- # Supress/don't_supress output (for 'noisy' applications), Pre-select (according to passed arguments) pulseaudio's sink and audio
- # channel volume levels... 'DefaultApplications' bash script removes/creates links to itself if run by 'root'.
- # Users can avoid having to type long 'Default*' commands by using 'l' script (local commands 'l --help'). They can also use
- # 'xdg-open'(shell wrapper) or a link to it, 'o' (open 'o --help'), to open documents/files/urls...
- # See also 'CommonMimeApps' below (many 'Default*' are associated to mime types).
- -When 'update-grub' runs, it will generate a configuration with the following entries in the grub menu (on top):
- 'Main Linux (Most recent kernel)'
- 'Emergency Linux (Most recent kernel)'
- 'External Sata Linux (Most recent kernel)'
- ...
- ls -l /etc/grub.d/07_custom
- lrwxrwxrwx 1 root root /etc/grub.d/07_custom -> /root/SystemLinks/Store/07_custom
- -Main 'common's services' files (CommonCron, CommonDaemon common - see below) are linked to $COMMON_DIR.
- -Extra processing (encrypting/decrypting, password request, etc.) for GUI session. See SystemLinks' DmSession_CommonSetup, DmSession_CommonCleanup.
- -Inserts configuration files for Linux distro' services, drivers... E.G. smartmontools, ufw, xorg...
- -Etc.
- **********************
- Services
- **********
- Main services:
- -'CommonSystemStartUp'. Bash script currently invoked by '$SYSTEMLINKS_STORE_DIR/CommonStartUpShutdown.service' after system boot.
- Clears common and user's temporary directories: $COMMON_MESSAGES_COMMON_DIR, $COMMON_MESSAGES_SYSTEM_DIR,
- $COMMON_TMP_STORE_DIR, $COMMON_TMP_DIR & every user's $HOME_TMP_DIR.
- Checks if several (as specified in file 'CommonSettings' - SystemLinks) distro's services are running.
- Starts main common services:
- 'CommonDaemon' for 'common' (see below).
- 'CommonCron' (see below).
- Creates $STARTINGUP file and removes it after a few seconds to let applications/services 'know' that system is starting up.
- Checks Internet connection and creates (or doesn't) files $LOCAL_NETWORK_ON & $INTERNET_CONNECTION_ON.
- Checks if 'USB controlled power strip' is available and creates (or doesn't) file $USB_CONTROLLED_POWER_STRIP_AVAILABLE.
- If 'USB controlled power strip' is available it handles switching on/off of 'USB controlled power strip's sockets.
- 'CommonSystemStartUp' sends internal mail to 'root' if problems are detected.
- Typical 'CommonSystemStartUp' output (from CommonLog): {
- 2019/Feb/12 17:01:02: SystemLinks after_boot.local: Invoking '$COMMON_ETC_DIR/CommonSystemStartUp'.
- 2019/Feb/12 17:01:02: CommonSystemStartUp: 'UsbControlledPowerStripAvailable' service check:
- 2019/Feb/12 17:01:04: CommonSystemStartUp: 'Usb Controlled PowerStrip' available.
- 2019/Feb/12 17:01:04: CommonSystemStartUp: '$COMMON_MESSAGES_COMMON_DIR' directory cleared.
- 2019/Feb/12 17:01:04: CommonSystemStartUp: '$STARTINGUP' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
- 2019/Feb/12 17:01:04: CommonSystemStartUp: '$COMMON_MESSAGES_SYSTEM_DIR' directory cleared (Except for '$STARTINGUP' & '$DISK_ERROR_WARNING').
- 2019/Feb/12 17:01:04: CommonSystemStartUp: '$USB_CONTROLLED_POWER_STRIP_AVAILABLE' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
- 2019/Feb/12 17:01:04: CommonSystemStartUp: '$COMMON_TMP_STORE_DIR' directory cleared.
- 2019/Feb/12 17:01:05: CommonSystemStartUp: '$COMMON_TMP_DIR' cleared.
- 2019/Feb/12 17:01:05: CommonSystemStartUp: manolo2's '$HOME_TMP_DIR' cleared.
- 2019/Feb/12 17:01:05: CommonSystemStartUp: manolo's '$HOME_TMP_DIR' cleared.
- 2019/Feb/12 17:01:05: CommonSystemStartUp: root's '$HOME_TMP_DIR' cleared.
- 2019/Feb/12 17:01:05: CommonSystemStartUp: ### Starting Services ###. BEGIN.
- 2019/Feb/12 17:01:06: CommonSystemStartUp: 'CommonDaemonForCommon' service start: {
- 2019/Feb/12 17:01:06: CommonDaemon: 'CommonDaemon common' running.
- 2019/Feb/12 17:01:06: }
- 2019/Feb/12 17:01:06:
- 2019/Feb/12 17:01:06: CommonSystemStartUp: 'CommonCron' service start: {
- 2019/Feb/12 17:01:06: CommonCron: Starting. Please wait.
- 2019/Feb/12 17:01:06: CommonCron: 'CommonCron' running. Parent's Pid: 1646.
- 2019/Feb/12 17:01:06: }
- 2019/Feb/12 17:01:06: CommonSystemStartUp: ### Starting Services ###. END.
- 2019/Feb/12 17:01:06: ###
- 2019/Feb/12 17:01:06: CommonSystemStartUp: ### Checking Services ###. BEGIN.
- 2019/Feb/12 17:01:06: CommonSystemStartUp: 'SmartDIsRunning' (Disk error early warning) service check:
- 2019/Feb/12 17:01:06: CommonSystemStartUp: 'smartd' daemon running.
- 2019/Feb/12 17:01:06:
- 2019/Feb/12 17:01:06: CommonSystemStartUp: 'ExternalNetworks_On' service check:
- 2019/Feb/12 17:01:07: CommonSystemStartUp: 'Firewall manager' running.
- 2019/Feb/12 17:01:10: CommonSystemStartUp: 'CheckNetworkConnection -r': {
- 2019/Feb/12 17:01:10: CheckNetworkConnection: Found router address: '192.168.1.1'.
- 2019/Feb/12 17:01:10: CheckNetworkConnection: Router contacted. Network connection On.
- 2019/Feb/12 17:01:10: CheckNetworkConnection: Server contact high (85%). Good Internet connection.
- 2019/Feb/12 17:01:10: CheckNetworkConnection: '$LOCAL_NETWORK_ON' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
- 2019/Feb/12 17:01:10: CheckNetworkConnection: '$INTERNET_CONNECTION_ON' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
- 2019/Feb/12 17:01:10: }
- 2019/Feb/12 17:01:10:
- 2019/Feb/12 17:01:10: CommonSystemStartUp: 'ExternalNetworks_Off' not found in 'CommonSystemStartUpChecksAndServices' variable. Checking skipped.
- 2019/Feb/12 17:01:11: CommonSystemStartUp: ### Checking Services ###. END.
- 2019/Feb/12 17:01:11: CommonSystemStartUp: '$STARTINGUP' removed from '$COMMON_MESSAGES_SYSTEM_DIR'.
- 2019/Feb/12 17:01:22: CommonSystemStartUp: 'OnOff_Monitor': OnOffMainsSocket04(-on): off -> on
- 2019/Feb/12 17:01:22: CommonSystemStartUp: Execution completed.
- 2019/Feb/12 17:01:22: SystemLinks after_boot.local: '$COMMON_ETC_DIR/CommonSystemStartUp' exited with code 0.
- }
- -'CommonSystemShutdown' (link to 'CommonSystemStartUp' above). Currently invoked by system 'shutdown', 'reboot', 'halt' or 'poweroff'
- ('shutdown' & 'reboot' can be invoked from a GUI session: '$COMMON_BIN_DIR/GuiSystemShutdown' via MainMenu).
- Creates $SHUTTINGDOWN file so that applications/services 'know' that system is shutting down.
- Waits until all critical processes (specified in file 'CommonSettings' - SystemLinks) have exited.
- If 'USB controlled power strip' is available, it handles switching on/off of 'USB controlled power strip's sockets.
- 'CommonSystemShutdown' sends internal mail to 'root' if problems are detected.
- Typical 'CommonSystemShutdown' output (from CommonLog): {
- 2019/Feb/12 10:34:33: halt(Wrapper): 'UsbControlledPowerStripAvailable' service check:
- 2019/Feb/12 10:34:34: halt(Wrapper): 'Usb Controlled PowerStrip' available.
- 2019/Feb/12 10:34:34: halt(Wrapper): '$SHUTTINGDOWN' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
- 2019/Feb/12 10:34:34: halt(Wrapper): ### Waiting for critical processes to exit ###. BEGIN.
- 2019/Feb/12 10:34:34: CommonDaemon: 'CommonDaemon common's loop stopped.
- 2019/Feb/12 10:34:35: CommonCron --loop: '$SHUTTINGDOWN' detected. Stopping loop.
- 2019/Feb/12 10:34:35: CommonCron --loop: Loop stopped. Exiting.
- 2019/Feb/12 10:34:35: CommonDaemon: Killing 'CommonDaemon common' background process.
- 2019/Feb/12 10:34:36: halt(Wrapper): ### Waiting for critical processes to exit ###. END.
- 2019/Feb/12 10:34:47: halt(Wrapper): 'OnOff_Monitor': OnOffMainsSocket04(-off): on -> off
- 2019/Feb/12 10:34:47: halt(Wrapper): Invoking '/sbin/shutdown -P now'.
- 2019/Feb/12 10:34:47: SystemLinks before_halt.local: '$SHUTTINGDOWN' found, '$COMMON_ETC_DIR/CommonSystemShutdown' will not run.
- 2019/Feb/12 10:34:49: halt(Wrapper): Execution completed.
- }
- -'CommonCron'. Bash script (does not use distro's 'cron'). Normally started by 'CommonSystemStartUp' (see above) after system boot.
- Can only be run by 'root' (except when used with option '--running' to find if it is running). It runs 'frequently', and
- SIMULTANEOUSLY, all required tasks for pseudo-user 'common' (as 'root') and for any other logged-in user (as 'user'). Tasks:
- frequently (currently every 5 minutes)
- hourly
- daily
- monthly
- weekly
- yearly
- Log files in '$COMMON_VAR_DIR/CommonCron' ('common') & '$HOME_VAR_DIR/CommonCron' (normal user).
- If one or more task's commands fail, the task log will be mailed to the corresponding user (and also sent to 'CommonLog',
- see below). Log will include a list of task's commands, highlighting the failed ones. E.G.:
- ...........................
- CommonCron.daily: History:
- - >ArchiveCommonLogs< ExitCode:0.
- - >RemindAndMailUser< ExitCode:0.
- - >FileVersions_CriticalFiles< ExitCode:0.
- - >FileVersions_JavaProjects< ExitCode:0.
- ! >RewriteLocalApplicationsMenu< ExitCode:69.
- - >HOMEdotDirsSave< ExitCode:0.
- ($USER: manolo; $HOME: /home/manolo)
- CommonCron.daily: Error!
- CommonCron --help
- 'CommonCron' cycles through a loop continuously and periodically (every 300 seconds) runs,
- simultaneously, tasks for all logged-in users (logged-in 'root' too) and for pseudo-user 'common'.
- Tasks to run are specified in '$HOME/CommonCronTasks/CommonCron.*' files for all logged-in users
- and in '$COMMON_DIR/CommonCronTasks/CommonCron.*' files for pseudo-user 'common'.
- Above directories and (default) files will be created if they don't exist. Tasks will be run as
- the corresponding user and with normal log-in environment. Tasks for pseudo-user 'common' will be
- run as 'root' and with 'HOME=$COMMON_DIR'. Logs will be saved in '$HOME_VAR_DIR/CommonCron' for
- normal users and in '$COMMON_VAR_DIR/CommonCron' for pseudo-user 'common'.
- Above directories will be created if they don't exist.
- Usage:
- 'CommonCron --start' Starts 'CommonCron' (Only 'root').
- 'CommonCron --stop' Stops 'CommonCron' (Only 'root').
- 'CommonCron --running' 'CommonCron' running? (Any user).
- Notes:
- Tasks: frequently (every 300 seconds), hourly, daily, monthly, weekly, yearly.
- 'CommonCron' will normaly be started by '$COMMON_ETC_DIR/CommonSystemStartUp' (System boot).
- 'CommonCron' will skip running tasks if file '$STARTINGUP' exists (System startup).
- 'CommonCron' will stop if file '$SHUTTINGDOWN' exists (System shutdown).
- 'CommonCron' will mail task's log to the corresponding user if any of the task's commands
- fails. Log will include a list of the task's commands, highlighting the failed ones.
- 'CommonCron --running's ExitCodes: 0: Running; 1: Not Running.
- -'CommonDaemon'. Bash script. General purpose daemon that can be run for any registered user (except 'root') and for
- pseudo-user 'common' (as 'root'). An instance running for 'common' is normally started by 'CommonSystemStartUp'
- (see above) after system boot. Current external scripts used in 'CommonDaemon' for 'common':
- * Conditions * * Actions *
- CommonAtActionNeeded AskUsersToSwitchPrinterOn
- NewRunAsRootRequest AskUsersToSwitchPrinterScannerOff
- PrinterNeedsPower CommonAt
- PrinterNeedsSwitchingOn DummyAction
- PrinterOffAndJobsPending NotifyRootMailIfNotCommonCron
- PrinterScannerIdle RunAsRoot
- PrinterScannerNeedsSwitchingOff UsbControlledPowerStripServices
- ScannerNeedsPower
- UsbControlledPowerStripActionNeeded
- CommonDaemon --help
- 'CommonDaemon' is a general purpose daemon. It continuously cycles through a loop
- performing the following actions:
- -Setting the boolean state of several (Internal and external) defined 'Conditions':
- Internal:
- IntNewTime1Hour true at loop start and once every hour.
- IntNewTime30Minutes true at loop start and once every 30 minutes.
- IntNewTime10Minutes true at loop start and once every 10 minutes.
- IntNewTime5Minutes true at loop start and once every 5 minutes.
- IntNewTime1Minute true at loop start and once every minute.
- IntNewTime30Seconds true at loop start and once every 30 seconds.
- IntNewTime10Seconds true at loop start and once every 10 seconds.
- IntNewTime5Seconds true at loop start and once every 5 seconds.
- IntNewTime2Seconds true at loop start and once every 2 seconds.
- Int_NeedToArchiveLogs true when there are too many log files.
- Int_RequestToStop true if RequestToStop message received.
- Int_SystemShuttingDown true if SystemShuttingDown message received.
- Int_SystemStartingUp true if SystemStartingUp message received.
- Int_TooManyBackgroundChildProcesses true if too many background child processes.
- Int_TooManyErrorMessages true if too many error messages.
- Int_NeedToReInitialize true if changes in configuration file or in
- 'Condition' and 'Action' script files.
- External:
- Named as the names of files in 'Conditions' directory (See below).
- -Checking Start_conditions (And launching those whose conditions are met) of several
- (Internal and external) defined 'Actions':
- Internal:
- Int_Initialize Re initializes daemon.
- Int_StopCommonDaemon Stops daemon's loop (And, later, daemon).
- Int_ArchiveLogs Creates log files archives in directory
- '$HOME/var/CommonDaemon/Logs' (See below).
- External:
- Named as the names of files in 'Actions' directory (See below).
- -Checking, every 5 seconds, if background child processes, launched by 'Actions', have
- finished and logging their process' run info.
- -Waiting the right time to keep the loop period stable: Wait time depends on work load.
- Once the daemon's loop has stopped the following actions will take place:
- -Waiting for background child processes to finish (Timeout configurable) and logging
- their process' run info.
- -Killing background child processes still running and logging their process' run info.
- -Logging daemon script process' info (Daemon has been running in background).
- 'CommonDaemon's Directories:
- '$HOME/CommonDaemonScripts' 'Condition' & 'Action' forms and configuration file.
- '$HOME/CommonDaemonScripts/Actions' 'Action' script files subdirectory.
- '$HOME/CommonDaemonScripts/Conditions' 'Condition' script files subdirectory.
- '$HOME/var/CommonDaemon/Logs' Log files directory.
- '$HOME/var/CommonDaemon/tmp' Temporary files directory.
- Main features of 'CommonDaemon':
- -Detects '$STARTINGUP' & '$SHUTTINGDOWN' (in $COMMON_MESSAGES_SYSTEM_DIR).
- -Automatic reinitialization of daemon if changes detected in configuration file
- or in 'Condition' and 'Action' script files (Checked every 5 seconds).
- -Checking of Actions' Start_conditions and Conditions' Change_detect_code at
- (re)initialization.
- -Loading of Actions' Start_conditions' and Conditions' Change_detect_code into
- memory, at (re)initialization, to avoid script reading overhead.
- -Automatic adjustment of loop period/frequency (Configurable) depending on workload.
- -Automatic archiving of log files (Log files size and archives directory configurable).
- -Mailing of error messages to user (Configurable).
- -Automatic daemon's loop stop when: '$SHUTTINGDOWN' detected or too many errors or
- too many Action's (background launched) child processes (Configurable).
- -Provides internal 'Conditions' whose boolean values can be used by external 'Action'
- and 'Condition' scripts.
- Usage:
- 'CommonDaemon user --start' Starts daemon.
- 'CommonDaemon user --stop' Stops daemon.
- 'CommonDaemon user --running' Checks if daemon is running.
- Notes:
- 'user' can be any registered user, except 'root', plus pseudo user 'common'.
- 'CommonDaemon user --start|--stop' must be invoked by 'user'.
- 'CommonDaemon common --start|--stop' must be invoked by 'root'. Will run with HOME=$COMMON_DIR.
- 'CommonDaemon user --running' can be invoked by any registered user. ExitCodes:
- 0: Running; 1: Not Running.
- Please run 'CommonDaemon' and read $HOME/CommonDaemonScripts/*Form for instructions on how
- to write 'Condition' and 'Action' scripts.
- Other services: 'Main services' (above) are used to run, periodically/when conditions change, other services:
- -Notifying users (mail, system temperatures, process killed...).
- -Powering on/off of 'USB controlled power strip's sockets (printer/scanner/external_HDs/Monitor/Audio_amplifier) when needed.
- -Allowing some users to run some commands as 'root'.
- -'At' service (does not use distro's 'at') to run commands at specific times.
- -Archiving log files.
- -Simple version control of files.
- -Backups and syncing of drives (see 'Backup Arrangements' below).
- -Updating data bases (Text, Audio, Video and movies, Images...).
- -Temperatures monitoring (issues warnings or even shuts down the system).
- -Killing of 'Intensive Cpu use' processes.
- -HD's failure warning (blocks backups and syncing of drives).
- -'CommonLog' (see details in 'Software' below).
- -'Reminders' (see details in 'Software' below).
- ...
- **********************
- Software
- **********
- -Administration.
- -'XSu': (Gui use of 'su') Lets user run a (graphical or otherwise) command as another_user/root if the correct password is given.
- -Users
- Create new user using '$COMMON_MISC_DIR/AddUser_Skeleton/*' skeleton types.
- User inherits $HOME directories, MainMenu, configuration, Mime type/Application associations... according to the chosen skeleton type.
- Each user is also assigned some 'real estate' in bulk storage partition '$COMMON_STORE_DIR'.
- Delete user.
- -Common Mime type/Application associations: Mime type/Application associations are kept in '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps'
- and are used as reference to update, periodically (CommonCron common daily), those of '/root' and '$COMMON_MISC_DIR/AddUser_Skeleton/*'
- (skeleton associations are inherited by new users). See 'CommonMimeApps' below.
- -Update '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps' from Main user's '$HOME/.config/mimeapps.list' & '$HOME/.local/share/applications'.
- -Each user can sync his/her Mime type/Application associations to '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps' (CommonCron user daily).
- -Commands run before/after GUI session. SystemLinks' DmSession_CommonCleanup & DmSession_CommonSetup:
- Decrypt and mount user's $HOME + other filesystems.
- Unmount (encrypted) user's $HOME + other filesystems.
- -Commands run before/after GUI session. '$COMMON_BIN_DIR/GraphicalSessionAutostart' (user configurable):
- Change desktop font size.
- Start MainMenu/network monitor, CommonDaemon for user...
- Stop CommonDaemon for user.
- -Start Normal GUI session applications '$COMMON_BIN_DIR/StartSessionApplications' (user configurable).
- -Block/Unblock/Check external networks.
- -Close GUI session/Shutdown system (from MainMenu).
- ...
- -Scripts and programs in, '$COMMON_BIN_DIR' & '$COMMON_SBIN_DIR', available to all users.
- -Bash functions library.
- In script '$COMMON_BIN_DIR/PrintLibraryFunctions'.
- Run 'PrintLibraryFunctions --help' to print a list of available functions
- or 'PrintLibraryFunctions FunctionName [FunctionName2 ...]' to print function(s)' code.
- Import library function(s) to a bash script's environment inserting:
- source <(PrintLibraryFunctions FunctionName [FunctionName2 ...]) || exit $?
- -CommonLog
- '$COMMON_BIN_DIR/CommonLog' used to log messages.
- Log files in '$COMMON_VAR_DIR/CommonLog' ('root' & 'common') & '$HOME_VAR_DIR/CommonLog' (normal user). It can also log to '/var/log/syslog'.
- Check 'CommonLog --help'
- -File version control scripts:
- -Available to 'common':
- 'FileVersions_CommonBins'
- 'FileVersions_CommonFiles'
- 'FileVersions_CommonJavaProjects'
- 'FileVersions_SystemCriticalFiles'
- 'FileVersions_This_System'
- -Available to normal users:
- 'FileVersions_CriticalFiles'
- 'FileVersions_CurrentJavaProjects'
- 'FileVersions_JavaProjects'
- 'FileVersions_SecondLifeText'
- -'At' scripts (using 'At' service):
- 'AlarmTellAt'
- 'At'
- 'AtQueue'
- 'AtRemove' -> 'AtQueue'
- 'MailAt'
- 'TellAt'
- -Distro independent (Oracle Java in '/home' partition).
- -Common Java libraries are available to all (Java programmer) users in '$COMMON_JAVA_DIR/CommonLibraries' (JavaDoc:
- '...CommonLibraries/CommonLibraries_JavaDoc.html'). See '$COMMON_DIR/SystemDocs/root_Applications/JavaIde.*.txt'
- -Java programs, part of 'common' software:
- ClassifyTextFiles.jar
- DetectCharSet.jar
- Dialog.jar
- Dialog_CheckList.jar Link to Dialog.jar.
- Dialog_DirectorySelection.jar Link to Dialog.jar.
- Dialog_FileSelection.jar Link to Dialog.jar.
- Dialog_InputText.jar Link to Dialog.jar.
- Dialog_Message.jar Link to Dialog.jar.
- Dialog_MessageTimed.jar Link to Dialog.jar.
- Dialog_RadioList.jar Link to Dialog.jar.
- FindTextInDocuments.jar
- JavaSources.jar
- MainMenuAndNetTraffic.jar
- PickAndRun.jar
- PickDirAndRun.jar
- Reminders.jar
- SearchAndPlayVideoFiles.jar
- ShowVideoItemInfo.jar
- XBeep.jar
- Java jar files are integrated in 'common's software by bash script '$COMMON_BIN_DIR/RunCommonJavaJar':
- RunCommonJavaJar --help
- 'RunCommonJavaJar' is a shell wrapper to run Java '*.jar' files. Normal
- users should not invoke it directly but through a link to it, with the same
- name (without extension) as the Java jar file, in '$COMMON_JAVA_JARS_DIR',
- that it should run.
- If there is a bash script file, in '$COMMON_JAVA_JARS_DIR', with the same name
- as the jar file, it will be run first to find out which extra java interpreter
- options are needed to run the java application.
- Environment variables exported before launching Java application:
- 'invokationPath' is set to the invoking link (Same as '$0' in bash).
- 'DISPLAY' is set to the value of '--display' option (if supplied). Note:
- Java applications, using a '--display' option, must check the option and
- 'DISPLAY' environment variable and generate appropriate error messages.
- When run by root, 'RunCommonJavaJar' will update the links available to run
- common Java '*.jar' files.
- Current links to this script:
- 'ClassifyTextFiles.jar': 'ClassifyTextFiles -> RunCommonJavaJar'.
- 'DetectCharSet.jar': 'DetectCharSet -> RunCommonJavaJar'.
- 'Dialog_CheckList.jar': 'Dialog_CheckList -> RunCommonJavaJar'.
- 'Dialog_DirectorySelection.jar': 'Dialog_DirectorySelection -> RunCommonJavaJar'.
- 'Dialog_FileSelection.jar': 'Dialog_FileSelection -> RunCommonJavaJar'.
- 'Dialog_InputText.jar': 'Dialog_InputText -> RunCommonJavaJar'.
- 'Dialog.jar': 'Dialog -> RunCommonJavaJar'.
- 'Dialog_Message.jar': 'Dialog_Message -> RunCommonJavaJar'.
- 'Dialog_MessageTimed.jar': 'Dialog_MessageTimed -> RunCommonJavaJar'.
- 'Dialog_RadioList.jar': 'Dialog_RadioList -> RunCommonJavaJar'.
- 'FindTextInDocuments.jar': 'FindTextInDocuments -> RunCommonJavaJar'.
- 'JavaSources.jar': 'JavaSources -> RunCommonJavaJar'.
- 'Java_XChartDemo.jar': 'Java_XChartDemo -> RunCommonJavaJar'.
- 'MainMenuAndNetTraffic.jar': 'MainMenuAndNetTraffic -> RunCommonJavaJar'.
- 'PickAndRun.jar': 'PickAndRun -> RunCommonJavaJar'.
- 'PickDirAndRun.jar': 'PickDirAndRun -> RunCommonJavaJar'.
- 'Reminders.jar': 'Reminders -> RunCommonJavaJar'.
- 'SearchAndPlayVideoFiles.jar': 'SearchAndPlayVideoFiles -> RunCommonJavaJar'.
- 'ShowVideoItemInfo.jar': 'ShowVideoItemInfo -> RunCommonJavaJar'.
- 'XBeep.jar': 'XBeep -> RunCommonJavaJar'.
- -Java program 'MainMenuAndNetTraffic' started (see '$COMMON_BIN_DIR/GraphicalSessionAutostart' above) for
- user after GUI login. 'MainMenuAndNetTraffic' shows, in a multi-level menu, *.desktop files in $HOME/.MainMenu
- and also displays system's networks' trafic in its window's name.
- -Java program 'Reminders' lets users set/view reminders and, together with services 'CommonCron' & 'At' (see above)
- and java program 'Dialog_*', can be used to remind users daily.
- -Applications to classify/browse/show/play/edit/search 'Common libraries' items (see below).
- -All kinds of bash scripts and some application wrappers in $COMMON_BIN_DIR and $COMMON_SBIN_DIR.
- Use 'BrowsePATH' to see which commands are available in the above directories: BrowsePATH --help
- 'BrowsePATH' lists executables available in PATH directories.
- Usage: 'BrowsePATH' (Current user's PATH).
- or
- Usage: 'BrowsePATH --root' (root's PATH).
- **********************
- Data
- **********
- Common data
- Encrypted data in $COMMON_DATA_DIR
- Multimedia in $COMMON_MULTIMEDIA_DIR
- Audio files in $COMMON_AUDIO_DIR
- Video files in $COMMON_VIDEO_DIR
- Image files in $COMMON_IMAGES_DIR
- Common libraries in $COMMON_TEXT_DIR
- Common libraries includes all types of documents in different formats, including
- 'bundles': archives including data and instructions on how to treat that data.
- Multimedia (Audio, Video, Images) is also included in the libraries. Items are
- sorted, in $COMMON_TEXT_DIR, by author and by categories as defined in
- '$COMMON_ETC_DIR/CommonTextKeys': ls -lR $COMMON_ETC_DIR/CommonTextKeys
- /home/common/etc/CommonTextKeys:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Biographies
- -rw-r--r-- 1 root root 0 Sep 7 2006 Economy
- drwxr-xr-x 2 root root 4096 Oct 3 2016 Etc
- drwxr-xr-x 3 root root 4096 Nov 28 2014 Fiction
- drwxr-xr-x 3 root root 4096 Mar 6 2007 History
- -rw-r--r-- 1 root root 0 Sep 7 2006 Philosophy
- drwxr-xr-x 4 root root 4096 Jan 28 2016 Science
- -rw-r--r-- 1 root root 0 Sep 7 2006 Travel
- -rw-r--r-- 1 root root 0 Sep 7 2006 Unclassified
- /home/common/etc/CommonTextKeys/Etc:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Audio_Database
- -rw-r--r-- 1 root root 0 Sep 7 2006 Dictionaries_Encyclopedias_Book_lists
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- -rw-r--r-- 1 root root 0 Sep 7 2006 Film_reviews
- -rw-r--r-- 1 root root 0 Sep 7 2006 Images_Database
- -rw-r--r-- 1 root root 0 Sep 7 2006 User_manuals_and_service_guides
- -rw-r--r-- 1 root root 0 Sep 7 2006 Video_Database
- /home/common/etc/CommonTextKeys/Fiction:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Comedy
- -rw-r--r-- 1 root root 0 Sep 7 2006 Crime_Action
- -rw-r--r-- 1 root root 0 Sep 7 2006 Erotism
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- -rw-r--r-- 1 root root 0 Sep 7 2006 Fantasy
- drwxr-xr-x 3 root root 4096 Mar 6 2007 Historical_Novel
- -rw-r--r-- 1 root root 0 Sep 7 2006 Mistery
- -rw-r--r-- 1 root root 0 Sep 7 2006 Paranormal
- -rw-r--r-- 1 root root 0 Sep 7 2006 Poetry
- -rw-r--r-- 1 root root 0 Sep 7 2006 Religion
- -rw-r--r-- 1 root root 0 Sep 7 2006 Romance
- -rw-r--r-- 1 root root 0 Sep 7 2006 Science_Fiction
- -rw-r--r-- 1 root root 0 Sep 7 2006 Short_stories
- -rw-r--r-- 1 root root 0 Sep 7 2006 Social_Fiction
- -rw-r--r-- 1 root root 0 Sep 7 2006 Tales_and_Legends
- -rw-r--r-- 1 root root 0 Sep 7 2006 Terror
- -rw-r--r-- 1 root root 0 Sep 7 2006 Theatre
- -rw-r--r-- 1 root root 0 Sep 7 2006 Travel
- /home/common/etc/CommonTextKeys/Fiction/Historical_Novel:
- -rw-r--r-- 1 root root 0 Sep 7 2006 1453CE-1789CE
- -rw-r--r-- 1 root root 0 Sep 7 2006 1789CE-Today
- drwxr-xr-x 2 root root 4096 Mar 6 2006 4000BCE-476CE
- -rw-r--r-- 1 root root 0 Sep 7 2006 476CE-1453CE
- -rw-r--r-- 1 root root 0 Sep 7 2006 Before_4000BCE
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- /home/common/etc/CommonTextKeys/Fiction/Historical_Novel/4000BCE-476CE:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Egypt
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- -rw-r--r-- 1 root root 0 Sep 7 2006 Greece
- -rw-r--r-- 1 root root 0 Sep 7 2006 Rome
- /home/common/etc/CommonTextKeys/History:
- -rw-r--r-- 1 root root 0 Sep 7 2006 1453CE-1789CE
- -rw-r--r-- 1 root root 0 Sep 7 2006 1789CE-Today
- drwxr-xr-x 2 root root 4096 Mar 6 2006 4000BCE-476CE
- -rw-r--r-- 1 root root 0 Sep 7 2006 476CE-1453CE
- -rw-r--r-- 1 root root 0 Sep 7 2006 Before_4000BCE
- /home/common/etc/CommonTextKeys/History/4000BCE-476CE:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Egypt
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- -rw-r--r-- 1 root root 0 Sep 7 2006 Greece
- -rw-r--r-- 1 root root 0 Sep 7 2006 Rome
- /home/common/etc/CommonTextKeys/Science:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Alternative_medicine
- -rw-r--r-- 1 root root 0 Sep 7 2006 Architecture
- -rw-r--r-- 1 root root 0 Sep 7 2006 Astronomy
- -rw-r--r-- 1 root root 0 Sep 7 2006 Biology
- -rw-r--r-- 1 root root 0 Sep 7 2006 Chemistry
- drwxr-xr-x 3 root root 4096 Oct 5 2013 Computer_Science
- -rw-r--r-- 1 root root 0 Sep 7 2006 Cosmology
- -rw-r--r-- 1 root root 0 Sep 7 2006 Earth_Sciences
- -rw-r--r-- 1 root root 0 Sep 7 2006 Economics
- drwxr-xr-x 2 root root 4096 Sep 12 2013 Electronics
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- -rw-r--r-- 1 root root 0 Sep 7 2006 Mathematics
- -rw-r--r-- 1 root root 0 Sep 7 2006 Medicine
- -rw-r--r-- 1 root root 0 Sep 7 2006 Physics
- -rw-r--r-- 1 root root 0 Sep 7 2006 Psychology
- -rw-r--r-- 1 root root 0 Sep 7 2006 Theory_of_Mind
- /home/common/etc/CommonTextKeys/Science/Computer_Science:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Artificial_intelligence
- -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
- -rw-r--r-- 1 root root 0 Sep 7 2006 Internet
- -rw-r--r-- 1 root root 0 Sep 7 2006 Java
- -rw-r--r-- 1 root root 0 Sep 7 2006 JavaScript
- -rw-r--r-- 1 root root 0 Sep 7 2006 Linux
- -rw-r--r-- 1 root root 0 Sep 7 2006 Lisp
- -rw-r--r-- 1 root root 0 Sep 7 2006 Software_applications
- drwxr-xr-x 2 root root 4096 Aug 23 2016 System_Docs
- /home/common/etc/CommonTextKeys/Science/Computer_Science/System_Docs:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Applications
- -rw-r--r-- 1 root root 0 Sep 7 2006 Distros
- -rw-r--r-- 1 root root 0 Sep 7 2006 Hardware
- -rw-r--r-- 1 root root 0 Sep 7 2006 Internet_Connection
- -rw-r--r-- 1 root root 0 Sep 7 2006 System
- -rw-r--r-- 1 root root 0 Sep 7 2006 This_PC
- /home/common/etc/CommonTextKeys/Science/Electronics:
- -rw-r--r-- 1 root root 0 Sep 7 2006 Modules_components
- -rw-r--r-- 1 root root 0 Sep 7 2006 Service_manuals
- -rw-r--r-- 1 root root 0 Sep 7 2006 Textbooks
- Notes:
- Preferred text document formats: .epub, .txt, .html, .htm, .odt, .pdf.
- There is 'common's software available to browse/show/play/edit/search common libraries.
- User data
- Each user inherits some filesystem 'real estate' in '$COMMON_STORE_DIR/UsersStore':
- df -h; echo; ls -l $HOME/Store $DOCUMENTS_DIR/{InetExchange,Multimedia,StoreEtc,StoreTemp};echo;cat $HOME/Store/ReadMe.txt
- Filesystem Size Used Avail Use% Mounted on
- udev 7.8G 12K 7.8G 1% /dev
- tmpfs 1.6G 1.6M 1.6G 1% /run
- /dev/sda3 19G 8.5G 9.3G 48% /
- none 4.0K 0 4.0K 0% /sys/fs/cgroup
- none 5.0M 0 5.0M 0% /run/lock
- none 7.8G 79M 7.8G 1% /run/shm
- none 100M 24K 100M 1% /run/user
- /dev/sda1 509M 3.2M 506M 1% /boot/efi
- /dev/sda4 19G 8.7G 9.1G 49% /home
- /dev/sda5 3.6T 2.4T 1.3T 66% /home/common/Store
- lrwxrwxrwx 1 manolo manolo 21 Jul 8 2014 /home/manolo/documents/InetExchange -> ../Store/InetExchange
- lrwxrwxrwx 1 manolo manolo 19 Mar 15 2016 /home/manolo/documents/Multimedia -> ../Store/Multimedia
- lrwxrwxrwx 1 manolo manolo 12 Jul 8 2014 /home/manolo/documents/StoreEtc -> ../Store/Etc
- lrwxrwxrwx 1 manolo manolo 25 Jul 8 2014 /home/manolo/documents/StoreTemp -> ../Store/.ScratchPad/Temp
- lrwxrwxrwx 1 manolo manolo 33 Oct 20 2017 /home/manolo/Store -> ../common/Store/UsersStore/manolo
- UsersStore: This directory is a link to '/home/common/Store/UsersStore/manolo'
- UsersStore: It can be used to store bulky files. Contents will be backed up regularly.
- UsersStore: (Subdirectory '.ScratchPad' will not be backed up).
- UsersStore: Best regards,
- UsersStore: Root.
- **************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement