Advertisement
Guest User

Common

a guest
Sep 20th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.32 KB | None | 0 0
  1. **************************************************************************************
  2. COMMON
  3. **********************
  4.  
  5. In this system a generous pseudo-user, 'common', provides all other users with environment, services, software and data.
  6. 'common's $HOME is $COMMON_DIR (currently /home/common).
  7.  
  8. **********************
  9. Environment
  10. **********
  11.  
  12. 'common's services support the following filesystems:
  13. MainLinux HD Main partitions: '/', '/home', '/home/common/Store' Internal HD
  14. EmergencyLinux HD Main partitions: '/', '/home', '/home/common/Store' Internal HD
  15. ExternalEmergencyLinux HD Main partitions: '/', '/home', '/home/common/Store' External HD
  16. # All HDs are interchangeable, see '$COMMON_DIR/SystemDocs/root_This_PC/Partitions.*.txt' for details.
  17. # 'grub's menu will let user choose which drive to boot from.
  18. # Link '$SYSTEMLINKS_DIR/DriveSpecific' determines how a HD is used: 'MainLinux', 'EmergencyLinux' or 'ExternalEmergencyLinux'.
  19. # The number of available/used HDs is specified in file '$SYSTEMLINKS_TO_LINK_DIR/CommonSettings' (see below).
  20.  
  21. One of the main advantages of Linux is that it is always changing (improving), unfortunately, if you write software
  22. that relies on its 'evolving' features, it is also a disadvantage. 'common' needs the Linux distro but tries
  23. to depend on it as little as possible (just bash and core-utils commands). The only 'common's structure which
  24. is hardware and distro dependent is the directory:
  25. $SYSTEMLINKS_DIR (currently '/root/SystemLinks'). With subdirectories:
  26. $SYSTEMLINKS_TO_LINK_DIR
  27. $SYSTEMLINKS_STORE_DIR
  28. $SYSTEMLINKS_STORE_DIR/Alternatives
  29.  
  30. Bash script '$SYSTEMLINKS_STORE_DIR/SystemLinks' (Link in '/root/bin') inserts/replaces/moves links in the Linux distro
  31. to adapt it to 'common's requirements.
  32. Running 'SystemLinks' modifies the Linux distro.
  33. Running 'SystemLinks -unlink' reverts the Linux distro to its original condition.
  34.  
  35. 'SystemLinks' actions:
  36. Links alternatives (as specified in file '$SYSTEMLINKS_TO_LINK_DIR/CommonSettings'), in '$SYSTEMLINKS_STORE_DIR/Alternatives',
  37. to $SYSTEMLINKS_STORE_DIR.
  38. Reads each file in $SYSTEMLINKS_TO_LINK_DIR and links the file, or the corresponding file/directory in $SYSTEMLINKS_STORE_DIR
  39. (specified in file), to a Linux distro's directory (or directories) (specified in file).
  40. 'SystemLinks -unlink' actions:
  41. Removes links that didn't exist originally in distro.
  42. Changes links that replaced Linux distro items so that they now point to the original items.
  43.  
  44. 'SystemLinks' runs weekly (see 'CommonCron' service, below) and sends internal mail to 'root' if it finds any changes in the
  45. links it created (I.E. when a distro update deletes/overwrites/renames a 'SystemLinks' link).
  46.  
  47. Typical 'SystemLinks' output: {
  48. SystemLinks: Alternative 'This_System.A.Linux-1' already linked to 'This_System'.
  49. SystemLinks: Alternative 'modules.A.Linux-1' already linked to 'modules'.
  50.  
  51. SystemLinks: 'local'(Store) already linked to '/usr'.
  52. SystemLinks: 'This_System'(Store) already linked to '/home/common'.
  53. SystemLinks: '07_custom'(Store) already linked to '/etc/grub.d'.
  54. SystemLinks: '20-nvidia.conf'(Store) already linked to '/etc/X11/Xsession.d'.
  55. SystemLinks: 'after_boot.local'(Store) already linked to '/etc'.
  56. SystemLinks: 'before_halt.local'(Store) already linked to '/etc'.
  57. SystemLinks: 'blacklist.conf'(Store) already linked to '/etc/modprobe.d'.
  58. SystemLinks: 'CommonCronTasks'(Store) already linked to '/home/common'.
  59. SystemLinks: 'CommonSettings'(Store) already linked to '/home/common/etc'.
  60. SystemLinks: 'CommonStartUpShutdown.service'(Store) already linked to '/etc/systemd/system/local-fs.target.wants'.
  61. SystemLinks: 'CommonStartUpShutdown.service'(Store) already linked to '/etc/systemd/system'.
  62. SystemLinks: 'data'(Store) already linked to '/usr/share/stardict'.
  63. SystemLinks: 'dic'(Store) already linked to '/usr/share/stardict'.
  64. SystemLinks: 'DiskErrorsWarning'(Store) already linked to '/etc'.
  65. SystemLinks: 'DmSession_CommonCleanup'(Store) already linked to '/etc'.
  66. SystemLinks: 'DmSession_CommonSetup'(Store) already linked to '/etc'.
  67. SystemLinks: 'fstab'(Store) already linked to '/etc'.
  68. SystemLinks: 'fstab.EmergencyLinux'(Store) already linked to '/etc'.
  69. SystemLinks: 'fstab.ExtEmergencyLinux'(Store) already linked to '/etc'.
  70. SystemLinks: 'fstab.MainLinux'(Store) already linked to '/etc'.
  71. SystemLinks: 'GraphicalSessionAutostart.desktop'(Store) already linked to '/etc/xdg/autostart'.
  72. SystemLinks: 'grub'(Store) already linked to '/etc/default'.
  73. SystemLinks: 'lightdm.conf'(Store) already linked to '/etc/lightdm'.
  74. SystemLinks: 'locale'(Store) already linked to '/etc/default'.
  75. SystemLinks: 'modules'(Store) already linked to '/etc'.
  76. SystemLinks: 'profile.local.sh'(Store) already linked to '/etc/profile.d'.
  77. SystemLinks: 'slick-greeter.conf'(Store) already linked to '/etc/lightdm'.
  78. SystemLinks: 'smartd.conf'(Store) already linked to '/etc'.
  79. SystemLinks: 'smartmontools'(Store) already linked to '/etc/default'.
  80. SystemLinks: 'treedict'(Store) already linked to '/usr/share/stardict'.
  81. SystemLinks: 'users.conf'(Store) already linked to '/etc/lightdm'.
  82. }
  83.  
  84. Some effects of 'SystemLinks' links:
  85. -Directory '$COMMON_DIR/UserLocal', in '/home' partition, linked to '/user/local', in '/' partition.
  86. ls -l $SYSTEMLINKS_STORE_DIR/local
  87. lrwxrwxrwx 1 root root /root/SystemLinks/Store/local -> /home/common/UserLocal
  88. ls -l /usr/local
  89. lrwxrwxrwx 1 root root /usr/local -> /root/SystemLinks/Store/local
  90. # '/user/local' provides, among other things, distro independent binaries E.G.: java.
  91. -Bash script 'profile.local.sh' runs (sourced by '/etc/profile') whenever there is a (GUI or otherwise) login,
  92. providing users with many environment variables, setting PATH, etc.
  93. ls -l /etc/profile.d/profile.local.sh
  94. lrwxrwxrwx 1 root root /etc/profile.d/profile.local.sh -> /root/SystemLinks/ToLink/profile.local.sh
  95. # Many environment variables have a path as value (if path exists). That, together with bash script 'DefaultApplications'
  96. # (see below), provides an EXTRA ABSTRACTION LAYER: Everywhere (scripts, applications, MainMenu...) paths are given as
  97. # environment variables and application names as 'Default*'. E.G. 'DefaultFileSystemBrowser $COMMON_JAVA_JARS_DIR'.
  98. #
  99. # If subdirectory '/home/common/CommonJava/CommonJavaJars' is moved to '/home/common/Misc/Jars' it is only necessary to change
  100. # the value of environment variable $COMMON_JAVA_JARS_DIR (by editing 'profile.local.sh'). If the distro's default filesystem
  101. # browser changes from 'nautilus' to 'nemo' it is only necessary to edit 'DefaultApplications' script for everything to work
  102. # correctly. Filetypes are also associated to 'Default*' application names ('$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps').
  103. #
  104. # The above scheme means that 'Default*' applications/commands are always run by invoking bash script 'DefaultApplications'. That
  105. # allows individual setting of 'Default*' application/command run conditions: Default options, Allow/don't_allow passing of arguments,
  106. # Supress/don't_supress output (for 'noisy' applications), Pre-select (according to passed arguments) pulseaudio's sink and audio
  107. # channel volume levels... 'DefaultApplications' bash script removes/creates links to itself if run by 'root'.
  108. # Users can avoid having to type long 'Default*' commands by using 'l' script (local commands 'l --help'). They can also use
  109. # 'xdg-open'(shell wrapper) or a link to it, 'o' (open 'o --help'), to open documents/files/urls...
  110. # See also 'CommonMimeApps' below (many 'Default*' are associated to mime types).
  111. -When 'update-grub' runs, it will generate a configuration with the following entries in the grub menu (on top):
  112. 'Main Linux (Most recent kernel)'
  113. 'Emergency Linux (Most recent kernel)'
  114. 'External Sata Linux (Most recent kernel)'
  115. ...
  116. ls -l /etc/grub.d/07_custom
  117. lrwxrwxrwx 1 root root /etc/grub.d/07_custom -> /root/SystemLinks/Store/07_custom
  118. -Main 'common's services' files (CommonCron, CommonDaemon common - see below) are linked to $COMMON_DIR.
  119. -Extra processing (encrypting/decrypting, password request, etc.) for GUI session. See SystemLinks' DmSession_CommonSetup, DmSession_CommonCleanup.
  120. -Inserts configuration files for Linux distro' services, drivers... E.G. smartmontools, ufw, xorg...
  121. -Etc.
  122.  
  123. **********************
  124. Services
  125. **********
  126.  
  127. Main services:
  128. -'CommonSystemStartUp'. Bash script currently invoked by '$SYSTEMLINKS_STORE_DIR/CommonStartUpShutdown.service' after system boot.
  129. Clears common and user's temporary directories: $COMMON_MESSAGES_COMMON_DIR, $COMMON_MESSAGES_SYSTEM_DIR,
  130. $COMMON_TMP_STORE_DIR, $COMMON_TMP_DIR & every user's $HOME_TMP_DIR.
  131. Checks if several (as specified in file 'CommonSettings' - SystemLinks) distro's services are running.
  132. Starts main common services:
  133. 'CommonDaemon' for 'common' (see below).
  134. 'CommonCron' (see below).
  135. Creates $STARTINGUP file and removes it after a few seconds to let applications/services 'know' that system is starting up.
  136. Checks Internet connection and creates (or doesn't) files $LOCAL_NETWORK_ON & $INTERNET_CONNECTION_ON.
  137. Checks if 'USB controlled power strip' is available and creates (or doesn't) file $USB_CONTROLLED_POWER_STRIP_AVAILABLE.
  138. If 'USB controlled power strip' is available it handles switching on/off of 'USB controlled power strip's sockets.
  139. 'CommonSystemStartUp' sends internal mail to 'root' if problems are detected.
  140. Typical 'CommonSystemStartUp' output (from CommonLog): {
  141. 2019/Feb/12 17:01:02: SystemLinks after_boot.local: Invoking '$COMMON_ETC_DIR/CommonSystemStartUp'.
  142. 2019/Feb/12 17:01:02: CommonSystemStartUp: 'UsbControlledPowerStripAvailable' service check:
  143. 2019/Feb/12 17:01:04: CommonSystemStartUp: 'Usb Controlled PowerStrip' available.
  144. 2019/Feb/12 17:01:04: CommonSystemStartUp: '$COMMON_MESSAGES_COMMON_DIR' directory cleared.
  145. 2019/Feb/12 17:01:04: CommonSystemStartUp: '$STARTINGUP' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
  146. 2019/Feb/12 17:01:04: CommonSystemStartUp: '$COMMON_MESSAGES_SYSTEM_DIR' directory cleared (Except for '$STARTINGUP' & '$DISK_ERROR_WARNING').
  147. 2019/Feb/12 17:01:04: CommonSystemStartUp: '$USB_CONTROLLED_POWER_STRIP_AVAILABLE' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
  148. 2019/Feb/12 17:01:04: CommonSystemStartUp: '$COMMON_TMP_STORE_DIR' directory cleared.
  149. 2019/Feb/12 17:01:05: CommonSystemStartUp: '$COMMON_TMP_DIR' cleared.
  150. 2019/Feb/12 17:01:05: CommonSystemStartUp: manolo2's '$HOME_TMP_DIR' cleared.
  151. 2019/Feb/12 17:01:05: CommonSystemStartUp: manolo's '$HOME_TMP_DIR' cleared.
  152. 2019/Feb/12 17:01:05: CommonSystemStartUp: root's '$HOME_TMP_DIR' cleared.
  153. 2019/Feb/12 17:01:05: CommonSystemStartUp: ### Starting Services ###. BEGIN.
  154. 2019/Feb/12 17:01:06: CommonSystemStartUp: 'CommonDaemonForCommon' service start: {
  155. 2019/Feb/12 17:01:06: CommonDaemon: 'CommonDaemon common' running.
  156. 2019/Feb/12 17:01:06: }
  157. 2019/Feb/12 17:01:06:
  158. 2019/Feb/12 17:01:06: CommonSystemStartUp: 'CommonCron' service start: {
  159. 2019/Feb/12 17:01:06: CommonCron: Starting. Please wait.
  160. 2019/Feb/12 17:01:06: CommonCron: 'CommonCron' running. Parent's Pid: 1646.
  161. 2019/Feb/12 17:01:06: }
  162. 2019/Feb/12 17:01:06: CommonSystemStartUp: ### Starting Services ###. END.
  163. 2019/Feb/12 17:01:06: ###
  164. 2019/Feb/12 17:01:06: CommonSystemStartUp: ### Checking Services ###. BEGIN.
  165. 2019/Feb/12 17:01:06: CommonSystemStartUp: 'SmartDIsRunning' (Disk error early warning) service check:
  166. 2019/Feb/12 17:01:06: CommonSystemStartUp: 'smartd' daemon running.
  167. 2019/Feb/12 17:01:06:
  168. 2019/Feb/12 17:01:06: CommonSystemStartUp: 'ExternalNetworks_On' service check:
  169. 2019/Feb/12 17:01:07: CommonSystemStartUp: 'Firewall manager' running.
  170. 2019/Feb/12 17:01:10: CommonSystemStartUp: 'CheckNetworkConnection -r': {
  171. 2019/Feb/12 17:01:10: CheckNetworkConnection: Found router address: '192.168.1.1'.
  172. 2019/Feb/12 17:01:10: CheckNetworkConnection: Router contacted. Network connection On.
  173. 2019/Feb/12 17:01:10: CheckNetworkConnection: Server contact high (85%). Good Internet connection.
  174. 2019/Feb/12 17:01:10: CheckNetworkConnection: '$LOCAL_NETWORK_ON' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
  175. 2019/Feb/12 17:01:10: CheckNetworkConnection: '$INTERNET_CONNECTION_ON' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
  176. 2019/Feb/12 17:01:10: }
  177. 2019/Feb/12 17:01:10:
  178. 2019/Feb/12 17:01:10: CommonSystemStartUp: 'ExternalNetworks_Off' not found in 'CommonSystemStartUpChecksAndServices' variable. Checking skipped.
  179. 2019/Feb/12 17:01:11: CommonSystemStartUp: ### Checking Services ###. END.
  180. 2019/Feb/12 17:01:11: CommonSystemStartUp: '$STARTINGUP' removed from '$COMMON_MESSAGES_SYSTEM_DIR'.
  181. 2019/Feb/12 17:01:22: CommonSystemStartUp: 'OnOff_Monitor': OnOffMainsSocket04(-on): off -> on
  182. 2019/Feb/12 17:01:22: CommonSystemStartUp: Execution completed.
  183. 2019/Feb/12 17:01:22: SystemLinks after_boot.local: '$COMMON_ETC_DIR/CommonSystemStartUp' exited with code 0.
  184. }
  185. -'CommonSystemShutdown' (link to 'CommonSystemStartUp' above). Currently invoked by system 'shutdown', 'reboot', 'halt' or 'poweroff'
  186. ('shutdown' & 'reboot' can be invoked from a GUI session: '$COMMON_BIN_DIR/GuiSystemShutdown' via MainMenu).
  187. Creates $SHUTTINGDOWN file so that applications/services 'know' that system is shutting down.
  188. Waits until all critical processes (specified in file 'CommonSettings' - SystemLinks) have exited.
  189. If 'USB controlled power strip' is available, it handles switching on/off of 'USB controlled power strip's sockets.
  190. 'CommonSystemShutdown' sends internal mail to 'root' if problems are detected.
  191. Typical 'CommonSystemShutdown' output (from CommonLog): {
  192. 2019/Feb/12 10:34:33: halt(Wrapper): 'UsbControlledPowerStripAvailable' service check:
  193. 2019/Feb/12 10:34:34: halt(Wrapper): 'Usb Controlled PowerStrip' available.
  194. 2019/Feb/12 10:34:34: halt(Wrapper): '$SHUTTINGDOWN' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
  195. 2019/Feb/12 10:34:34: halt(Wrapper): ### Waiting for critical processes to exit ###. BEGIN.
  196. 2019/Feb/12 10:34:34: CommonDaemon: 'CommonDaemon common's loop stopped.
  197. 2019/Feb/12 10:34:35: CommonCron --loop: '$SHUTTINGDOWN' detected. Stopping loop.
  198. 2019/Feb/12 10:34:35: CommonCron --loop: Loop stopped. Exiting.
  199. 2019/Feb/12 10:34:35: CommonDaemon: Killing 'CommonDaemon common' background process.
  200. 2019/Feb/12 10:34:36: halt(Wrapper): ### Waiting for critical processes to exit ###. END.
  201. 2019/Feb/12 10:34:47: halt(Wrapper): 'OnOff_Monitor': OnOffMainsSocket04(-off): on -> off
  202. 2019/Feb/12 10:34:47: halt(Wrapper): Invoking '/sbin/shutdown -P now'.
  203. 2019/Feb/12 10:34:47: SystemLinks before_halt.local: '$SHUTTINGDOWN' found, '$COMMON_ETC_DIR/CommonSystemShutdown' will not run.
  204. 2019/Feb/12 10:34:49: halt(Wrapper): Execution completed.
  205. }
  206. -'CommonCron'. Bash script (does not use distro's 'cron'). Normally started by 'CommonSystemStartUp' (see above) after system boot.
  207. Can only be run by 'root' (except when used with option '--running' to find if it is running). It runs 'frequently', and
  208. SIMULTANEOUSLY, all required tasks for pseudo-user 'common' (as 'root') and for any other logged-in user (as 'user'). Tasks:
  209. frequently (currently every 5 minutes)
  210. hourly
  211. daily
  212. monthly
  213. weekly
  214. yearly
  215. Log files in '$COMMON_VAR_DIR/CommonCron' ('common') & '$HOME_VAR_DIR/CommonCron' (normal user).
  216. If one or more task's commands fail, the task log will be mailed to the corresponding user (and also sent to 'CommonLog',
  217. see below). Log will include a list of task's commands, highlighting the failed ones. E.G.:
  218. ...........................
  219. CommonCron.daily: History:
  220. - >ArchiveCommonLogs< ExitCode:0.
  221. - >RemindAndMailUser< ExitCode:0.
  222. - >FileVersions_CriticalFiles< ExitCode:0.
  223. - >FileVersions_JavaProjects< ExitCode:0.
  224. ! >RewriteLocalApplicationsMenu< ExitCode:69.
  225. - >HOMEdotDirsSave< ExitCode:0.
  226. ($USER: manolo; $HOME: /home/manolo)
  227. CommonCron.daily: Error!
  228. CommonCron --help
  229. 'CommonCron' cycles through a loop continuously and periodically (every 300 seconds) runs,
  230. simultaneously, tasks for all logged-in users (logged-in 'root' too) and for pseudo-user 'common'.
  231. Tasks to run are specified in '$HOME/CommonCronTasks/CommonCron.*' files for all logged-in users
  232. and in '$COMMON_DIR/CommonCronTasks/CommonCron.*' files for pseudo-user 'common'.
  233. Above directories and (default) files will be created if they don't exist. Tasks will be run as
  234. the corresponding user and with normal log-in environment. Tasks for pseudo-user 'common' will be
  235. run as 'root' and with 'HOME=$COMMON_DIR'. Logs will be saved in '$HOME_VAR_DIR/CommonCron' for
  236. normal users and in '$COMMON_VAR_DIR/CommonCron' for pseudo-user 'common'.
  237. Above directories will be created if they don't exist.
  238. Usage:
  239. 'CommonCron --start' Starts 'CommonCron' (Only 'root').
  240. 'CommonCron --stop' Stops 'CommonCron' (Only 'root').
  241. 'CommonCron --running' 'CommonCron' running? (Any user).
  242. Notes:
  243. Tasks: frequently (every 300 seconds), hourly, daily, monthly, weekly, yearly.
  244. 'CommonCron' will normaly be started by '$COMMON_ETC_DIR/CommonSystemStartUp' (System boot).
  245. 'CommonCron' will skip running tasks if file '$STARTINGUP' exists (System startup).
  246. 'CommonCron' will stop if file '$SHUTTINGDOWN' exists (System shutdown).
  247. 'CommonCron' will mail task's log to the corresponding user if any of the task's commands
  248. fails. Log will include a list of the task's commands, highlighting the failed ones.
  249. 'CommonCron --running's ExitCodes: 0: Running; 1: Not Running.
  250. -'CommonDaemon'. Bash script. General purpose daemon that can be run for any registered user (except 'root') and for
  251. pseudo-user 'common' (as 'root'). An instance running for 'common' is normally started by 'CommonSystemStartUp'
  252. (see above) after system boot. Current external scripts used in 'CommonDaemon' for 'common':
  253. * Conditions * * Actions *
  254. CommonAtActionNeeded AskUsersToSwitchPrinterOn
  255. NewRunAsRootRequest AskUsersToSwitchPrinterScannerOff
  256. PrinterNeedsPower CommonAt
  257. PrinterNeedsSwitchingOn DummyAction
  258. PrinterOffAndJobsPending NotifyRootMailIfNotCommonCron
  259. PrinterScannerIdle RunAsRoot
  260. PrinterScannerNeedsSwitchingOff UsbControlledPowerStripServices
  261. ScannerNeedsPower
  262. UsbControlledPowerStripActionNeeded
  263. CommonDaemon --help
  264. 'CommonDaemon' is a general purpose daemon. It continuously cycles through a loop
  265. performing the following actions:
  266. -Setting the boolean state of several (Internal and external) defined 'Conditions':
  267. Internal:
  268. IntNewTime1Hour true at loop start and once every hour.
  269. IntNewTime30Minutes true at loop start and once every 30 minutes.
  270. IntNewTime10Minutes true at loop start and once every 10 minutes.
  271. IntNewTime5Minutes true at loop start and once every 5 minutes.
  272. IntNewTime1Minute true at loop start and once every minute.
  273. IntNewTime30Seconds true at loop start and once every 30 seconds.
  274. IntNewTime10Seconds true at loop start and once every 10 seconds.
  275. IntNewTime5Seconds true at loop start and once every 5 seconds.
  276. IntNewTime2Seconds true at loop start and once every 2 seconds.
  277. Int_NeedToArchiveLogs true when there are too many log files.
  278. Int_RequestToStop true if RequestToStop message received.
  279. Int_SystemShuttingDown true if SystemShuttingDown message received.
  280. Int_SystemStartingUp true if SystemStartingUp message received.
  281. Int_TooManyBackgroundChildProcesses true if too many background child processes.
  282. Int_TooManyErrorMessages true if too many error messages.
  283. Int_NeedToReInitialize true if changes in configuration file or in
  284. 'Condition' and 'Action' script files.
  285. External:
  286. Named as the names of files in 'Conditions' directory (See below).
  287. -Checking Start_conditions (And launching those whose conditions are met) of several
  288. (Internal and external) defined 'Actions':
  289. Internal:
  290. Int_Initialize Re initializes daemon.
  291. Int_StopCommonDaemon Stops daemon's loop (And, later, daemon).
  292. Int_ArchiveLogs Creates log files archives in directory
  293. '$HOME/var/CommonDaemon/Logs' (See below).
  294. External:
  295. Named as the names of files in 'Actions' directory (See below).
  296. -Checking, every 5 seconds, if background child processes, launched by 'Actions', have
  297. finished and logging their process' run info.
  298. -Waiting the right time to keep the loop period stable: Wait time depends on work load.
  299. Once the daemon's loop has stopped the following actions will take place:
  300. -Waiting for background child processes to finish (Timeout configurable) and logging
  301. their process' run info.
  302. -Killing background child processes still running and logging their process' run info.
  303. -Logging daemon script process' info (Daemon has been running in background).
  304. 'CommonDaemon's Directories:
  305. '$HOME/CommonDaemonScripts' 'Condition' & 'Action' forms and configuration file.
  306. '$HOME/CommonDaemonScripts/Actions' 'Action' script files subdirectory.
  307. '$HOME/CommonDaemonScripts/Conditions' 'Condition' script files subdirectory.
  308. '$HOME/var/CommonDaemon/Logs' Log files directory.
  309. '$HOME/var/CommonDaemon/tmp' Temporary files directory.
  310. Main features of 'CommonDaemon':
  311. -Detects '$STARTINGUP' & '$SHUTTINGDOWN' (in $COMMON_MESSAGES_SYSTEM_DIR).
  312. -Automatic reinitialization of daemon if changes detected in configuration file
  313. or in 'Condition' and 'Action' script files (Checked every 5 seconds).
  314. -Checking of Actions' Start_conditions and Conditions' Change_detect_code at
  315. (re)initialization.
  316. -Loading of Actions' Start_conditions' and Conditions' Change_detect_code into
  317. memory, at (re)initialization, to avoid script reading overhead.
  318. -Automatic adjustment of loop period/frequency (Configurable) depending on workload.
  319. -Automatic archiving of log files (Log files size and archives directory configurable).
  320. -Mailing of error messages to user (Configurable).
  321. -Automatic daemon's loop stop when: '$SHUTTINGDOWN' detected or too many errors or
  322. too many Action's (background launched) child processes (Configurable).
  323. -Provides internal 'Conditions' whose boolean values can be used by external 'Action'
  324. and 'Condition' scripts.
  325. Usage:
  326. 'CommonDaemon user --start' Starts daemon.
  327. 'CommonDaemon user --stop' Stops daemon.
  328. 'CommonDaemon user --running' Checks if daemon is running.
  329. Notes:
  330. 'user' can be any registered user, except 'root', plus pseudo user 'common'.
  331. 'CommonDaemon user --start|--stop' must be invoked by 'user'.
  332. 'CommonDaemon common --start|--stop' must be invoked by 'root'. Will run with HOME=$COMMON_DIR.
  333. 'CommonDaemon user --running' can be invoked by any registered user. ExitCodes:
  334. 0: Running; 1: Not Running.
  335. Please run 'CommonDaemon' and read $HOME/CommonDaemonScripts/*Form for instructions on how
  336. to write 'Condition' and 'Action' scripts.
  337.  
  338. Other services: 'Main services' (above) are used to run, periodically/when conditions change, other services:
  339. -Notifying users (mail, system temperatures, process killed...).
  340. -Powering on/off of 'USB controlled power strip's sockets (printer/scanner/external_HDs/Monitor/Audio_amplifier) when needed.
  341. -Allowing some users to run some commands as 'root'.
  342. -'At' service (does not use distro's 'at') to run commands at specific times.
  343. -Archiving log files.
  344. -Simple version control of files.
  345. -Backups and syncing of drives (see 'Backup Arrangements' below).
  346. -Updating data bases (Text, Audio, Video and movies, Images...).
  347. -Temperatures monitoring (issues warnings or even shuts down the system).
  348. -Killing of 'Intensive Cpu use' processes.
  349. -HD's failure warning (blocks backups and syncing of drives).
  350. -'CommonLog' (see details in 'Software' below).
  351. -'Reminders' (see details in 'Software' below).
  352. ...
  353.  
  354. **********************
  355. Software
  356. **********
  357.  
  358. -Administration.
  359. -'XSu': (Gui use of 'su') Lets user run a (graphical or otherwise) command as another_user/root if the correct password is given.
  360. -Users
  361. Create new user using '$COMMON_MISC_DIR/AddUser_Skeleton/*' skeleton types.
  362. User inherits $HOME directories, MainMenu, configuration, Mime type/Application associations... according to the chosen skeleton type.
  363. Each user is also assigned some 'real estate' in bulk storage partition '$COMMON_STORE_DIR'.
  364. Delete user.
  365. -Common Mime type/Application associations: Mime type/Application associations are kept in '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps'
  366. and are used as reference to update, periodically (CommonCron common daily), those of '/root' and '$COMMON_MISC_DIR/AddUser_Skeleton/*'
  367. (skeleton associations are inherited by new users). See 'CommonMimeApps' below.
  368. -Update '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps' from Main user's '$HOME/.config/mimeapps.list' & '$HOME/.local/share/applications'.
  369. -Each user can sync his/her Mime type/Application associations to '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps' (CommonCron user daily).
  370. -Commands run before/after GUI session. SystemLinks' DmSession_CommonCleanup & DmSession_CommonSetup:
  371. Decrypt and mount user's $HOME + other filesystems.
  372. Unmount (encrypted) user's $HOME + other filesystems.
  373. -Commands run before/after GUI session. '$COMMON_BIN_DIR/GraphicalSessionAutostart' (user configurable):
  374. Change desktop font size.
  375. Start MainMenu/network monitor, CommonDaemon for user...
  376. Stop CommonDaemon for user.
  377. -Start Normal GUI session applications '$COMMON_BIN_DIR/StartSessionApplications' (user configurable).
  378. -Block/Unblock/Check external networks.
  379. -Close GUI session/Shutdown system (from MainMenu).
  380. ...
  381. -Scripts and programs in, '$COMMON_BIN_DIR' & '$COMMON_SBIN_DIR', available to all users.
  382. -Bash functions library.
  383. In script '$COMMON_BIN_DIR/PrintLibraryFunctions'.
  384. Run 'PrintLibraryFunctions --help' to print a list of available functions
  385. or 'PrintLibraryFunctions FunctionName [FunctionName2 ...]' to print function(s)' code.
  386. Import library function(s) to a bash script's environment inserting:
  387. source <(PrintLibraryFunctions FunctionName [FunctionName2 ...]) || exit $?
  388. -CommonLog
  389. '$COMMON_BIN_DIR/CommonLog' used to log messages.
  390. Log files in '$COMMON_VAR_DIR/CommonLog' ('root' & 'common') & '$HOME_VAR_DIR/CommonLog' (normal user). It can also log to '/var/log/syslog'.
  391. Check 'CommonLog --help'
  392. -File version control scripts:
  393. -Available to 'common':
  394. 'FileVersions_CommonBins'
  395. 'FileVersions_CommonFiles'
  396. 'FileVersions_CommonJavaProjects'
  397. 'FileVersions_SystemCriticalFiles'
  398. 'FileVersions_This_System'
  399. -Available to normal users:
  400. 'FileVersions_CriticalFiles'
  401. 'FileVersions_CurrentJavaProjects'
  402. 'FileVersions_JavaProjects'
  403. 'FileVersions_SecondLifeText'
  404. -'At' scripts (using 'At' service):
  405. 'AlarmTellAt'
  406. 'At'
  407. 'AtQueue'
  408. 'AtRemove' -> 'AtQueue'
  409. 'MailAt'
  410. 'TellAt'
  411. -Distro independent (Oracle Java in '/home' partition).
  412. -Common Java libraries are available to all (Java programmer) users in '$COMMON_JAVA_DIR/CommonLibraries' (JavaDoc:
  413. '...CommonLibraries/CommonLibraries_JavaDoc.html'). See '$COMMON_DIR/SystemDocs/root_Applications/JavaIde.*.txt'
  414. -Java programs, part of 'common' software:
  415. ClassifyTextFiles.jar
  416. DetectCharSet.jar
  417. Dialog.jar
  418. Dialog_CheckList.jar Link to Dialog.jar.
  419. Dialog_DirectorySelection.jar Link to Dialog.jar.
  420. Dialog_FileSelection.jar Link to Dialog.jar.
  421. Dialog_InputText.jar Link to Dialog.jar.
  422. Dialog_Message.jar Link to Dialog.jar.
  423. Dialog_MessageTimed.jar Link to Dialog.jar.
  424. Dialog_RadioList.jar Link to Dialog.jar.
  425. FindTextInDocuments.jar
  426. JavaSources.jar
  427. MainMenuAndNetTraffic.jar
  428. PickAndRun.jar
  429. PickDirAndRun.jar
  430. Reminders.jar
  431. SearchAndPlayVideoFiles.jar
  432. ShowVideoItemInfo.jar
  433. XBeep.jar
  434. Java jar files are integrated in 'common's software by bash script '$COMMON_BIN_DIR/RunCommonJavaJar':
  435. RunCommonJavaJar --help
  436. 'RunCommonJavaJar' is a shell wrapper to run Java '*.jar' files. Normal
  437. users should not invoke it directly but through a link to it, with the same
  438. name (without extension) as the Java jar file, in '$COMMON_JAVA_JARS_DIR',
  439. that it should run.
  440. If there is a bash script file, in '$COMMON_JAVA_JARS_DIR', with the same name
  441. as the jar file, it will be run first to find out which extra java interpreter
  442. options are needed to run the java application.
  443. Environment variables exported before launching Java application:
  444. 'invokationPath' is set to the invoking link (Same as '$0' in bash).
  445. 'DISPLAY' is set to the value of '--display' option (if supplied). Note:
  446. Java applications, using a '--display' option, must check the option and
  447. 'DISPLAY' environment variable and generate appropriate error messages.
  448. When run by root, 'RunCommonJavaJar' will update the links available to run
  449. common Java '*.jar' files.
  450. Current links to this script:
  451. 'ClassifyTextFiles.jar': 'ClassifyTextFiles -> RunCommonJavaJar'.
  452. 'DetectCharSet.jar': 'DetectCharSet -> RunCommonJavaJar'.
  453. 'Dialog_CheckList.jar': 'Dialog_CheckList -> RunCommonJavaJar'.
  454. 'Dialog_DirectorySelection.jar': 'Dialog_DirectorySelection -> RunCommonJavaJar'.
  455. 'Dialog_FileSelection.jar': 'Dialog_FileSelection -> RunCommonJavaJar'.
  456. 'Dialog_InputText.jar': 'Dialog_InputText -> RunCommonJavaJar'.
  457. 'Dialog.jar': 'Dialog -> RunCommonJavaJar'.
  458. 'Dialog_Message.jar': 'Dialog_Message -> RunCommonJavaJar'.
  459. 'Dialog_MessageTimed.jar': 'Dialog_MessageTimed -> RunCommonJavaJar'.
  460. 'Dialog_RadioList.jar': 'Dialog_RadioList -> RunCommonJavaJar'.
  461. 'FindTextInDocuments.jar': 'FindTextInDocuments -> RunCommonJavaJar'.
  462. 'JavaSources.jar': 'JavaSources -> RunCommonJavaJar'.
  463. 'Java_XChartDemo.jar': 'Java_XChartDemo -> RunCommonJavaJar'.
  464. 'MainMenuAndNetTraffic.jar': 'MainMenuAndNetTraffic -> RunCommonJavaJar'.
  465. 'PickAndRun.jar': 'PickAndRun -> RunCommonJavaJar'.
  466. 'PickDirAndRun.jar': 'PickDirAndRun -> RunCommonJavaJar'.
  467. 'Reminders.jar': 'Reminders -> RunCommonJavaJar'.
  468. 'SearchAndPlayVideoFiles.jar': 'SearchAndPlayVideoFiles -> RunCommonJavaJar'.
  469. 'ShowVideoItemInfo.jar': 'ShowVideoItemInfo -> RunCommonJavaJar'.
  470. 'XBeep.jar': 'XBeep -> RunCommonJavaJar'.
  471. -Java program 'MainMenuAndNetTraffic' started (see '$COMMON_BIN_DIR/GraphicalSessionAutostart' above) for
  472. user after GUI login. 'MainMenuAndNetTraffic' shows, in a multi-level menu, *.desktop files in $HOME/.MainMenu
  473. and also displays system's networks' trafic in its window's name.
  474. -Java program 'Reminders' lets users set/view reminders and, together with services 'CommonCron' & 'At' (see above)
  475. and java program 'Dialog_*', can be used to remind users daily.
  476. -Applications to classify/browse/show/play/edit/search 'Common libraries' items (see below).
  477. -All kinds of bash scripts and some application wrappers in $COMMON_BIN_DIR and $COMMON_SBIN_DIR.
  478. Use 'BrowsePATH' to see which commands are available in the above directories: BrowsePATH --help
  479. 'BrowsePATH' lists executables available in PATH directories.
  480. Usage: 'BrowsePATH' (Current user's PATH).
  481. or
  482. Usage: 'BrowsePATH --root' (root's PATH).
  483.  
  484. **********************
  485. Data
  486. **********
  487.  
  488. Common data
  489. Encrypted data in $COMMON_DATA_DIR
  490. Multimedia in $COMMON_MULTIMEDIA_DIR
  491. Audio files in $COMMON_AUDIO_DIR
  492. Video files in $COMMON_VIDEO_DIR
  493. Image files in $COMMON_IMAGES_DIR
  494. Common libraries in $COMMON_TEXT_DIR
  495. Common libraries includes all types of documents in different formats, including
  496. 'bundles': archives including data and instructions on how to treat that data.
  497. Multimedia (Audio, Video, Images) is also included in the libraries. Items are
  498. sorted, in $COMMON_TEXT_DIR, by author and by categories as defined in
  499. '$COMMON_ETC_DIR/CommonTextKeys': ls -lR $COMMON_ETC_DIR/CommonTextKeys
  500. /home/common/etc/CommonTextKeys:
  501. -rw-r--r-- 1 root root 0 Sep 7 2006 Biographies
  502. -rw-r--r-- 1 root root 0 Sep 7 2006 Economy
  503. drwxr-xr-x 2 root root 4096 Oct 3 2016 Etc
  504. drwxr-xr-x 3 root root 4096 Nov 28 2014 Fiction
  505. drwxr-xr-x 3 root root 4096 Mar 6 2007 History
  506. -rw-r--r-- 1 root root 0 Sep 7 2006 Philosophy
  507. drwxr-xr-x 4 root root 4096 Jan 28 2016 Science
  508. -rw-r--r-- 1 root root 0 Sep 7 2006 Travel
  509. -rw-r--r-- 1 root root 0 Sep 7 2006 Unclassified
  510. /home/common/etc/CommonTextKeys/Etc:
  511. -rw-r--r-- 1 root root 0 Sep 7 2006 Audio_Database
  512. -rw-r--r-- 1 root root 0 Sep 7 2006 Dictionaries_Encyclopedias_Book_lists
  513. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  514. -rw-r--r-- 1 root root 0 Sep 7 2006 Film_reviews
  515. -rw-r--r-- 1 root root 0 Sep 7 2006 Images_Database
  516. -rw-r--r-- 1 root root 0 Sep 7 2006 User_manuals_and_service_guides
  517. -rw-r--r-- 1 root root 0 Sep 7 2006 Video_Database
  518. /home/common/etc/CommonTextKeys/Fiction:
  519. -rw-r--r-- 1 root root 0 Sep 7 2006 Comedy
  520. -rw-r--r-- 1 root root 0 Sep 7 2006 Crime_Action
  521. -rw-r--r-- 1 root root 0 Sep 7 2006 Erotism
  522. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  523. -rw-r--r-- 1 root root 0 Sep 7 2006 Fantasy
  524. drwxr-xr-x 3 root root 4096 Mar 6 2007 Historical_Novel
  525. -rw-r--r-- 1 root root 0 Sep 7 2006 Mistery
  526. -rw-r--r-- 1 root root 0 Sep 7 2006 Paranormal
  527. -rw-r--r-- 1 root root 0 Sep 7 2006 Poetry
  528. -rw-r--r-- 1 root root 0 Sep 7 2006 Religion
  529. -rw-r--r-- 1 root root 0 Sep 7 2006 Romance
  530. -rw-r--r-- 1 root root 0 Sep 7 2006 Science_Fiction
  531. -rw-r--r-- 1 root root 0 Sep 7 2006 Short_stories
  532. -rw-r--r-- 1 root root 0 Sep 7 2006 Social_Fiction
  533. -rw-r--r-- 1 root root 0 Sep 7 2006 Tales_and_Legends
  534. -rw-r--r-- 1 root root 0 Sep 7 2006 Terror
  535. -rw-r--r-- 1 root root 0 Sep 7 2006 Theatre
  536. -rw-r--r-- 1 root root 0 Sep 7 2006 Travel
  537. /home/common/etc/CommonTextKeys/Fiction/Historical_Novel:
  538. -rw-r--r-- 1 root root 0 Sep 7 2006 1453CE-1789CE
  539. -rw-r--r-- 1 root root 0 Sep 7 2006 1789CE-Today
  540. drwxr-xr-x 2 root root 4096 Mar 6 2006 4000BCE-476CE
  541. -rw-r--r-- 1 root root 0 Sep 7 2006 476CE-1453CE
  542. -rw-r--r-- 1 root root 0 Sep 7 2006 Before_4000BCE
  543. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  544. /home/common/etc/CommonTextKeys/Fiction/Historical_Novel/4000BCE-476CE:
  545. -rw-r--r-- 1 root root 0 Sep 7 2006 Egypt
  546. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  547. -rw-r--r-- 1 root root 0 Sep 7 2006 Greece
  548. -rw-r--r-- 1 root root 0 Sep 7 2006 Rome
  549. /home/common/etc/CommonTextKeys/History:
  550. -rw-r--r-- 1 root root 0 Sep 7 2006 1453CE-1789CE
  551. -rw-r--r-- 1 root root 0 Sep 7 2006 1789CE-Today
  552. drwxr-xr-x 2 root root 4096 Mar 6 2006 4000BCE-476CE
  553. -rw-r--r-- 1 root root 0 Sep 7 2006 476CE-1453CE
  554. -rw-r--r-- 1 root root 0 Sep 7 2006 Before_4000BCE
  555. /home/common/etc/CommonTextKeys/History/4000BCE-476CE:
  556. -rw-r--r-- 1 root root 0 Sep 7 2006 Egypt
  557. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  558. -rw-r--r-- 1 root root 0 Sep 7 2006 Greece
  559. -rw-r--r-- 1 root root 0 Sep 7 2006 Rome
  560. /home/common/etc/CommonTextKeys/Science:
  561. -rw-r--r-- 1 root root 0 Sep 7 2006 Alternative_medicine
  562. -rw-r--r-- 1 root root 0 Sep 7 2006 Architecture
  563. -rw-r--r-- 1 root root 0 Sep 7 2006 Astronomy
  564. -rw-r--r-- 1 root root 0 Sep 7 2006 Biology
  565. -rw-r--r-- 1 root root 0 Sep 7 2006 Chemistry
  566. drwxr-xr-x 3 root root 4096 Oct 5 2013 Computer_Science
  567. -rw-r--r-- 1 root root 0 Sep 7 2006 Cosmology
  568. -rw-r--r-- 1 root root 0 Sep 7 2006 Earth_Sciences
  569. -rw-r--r-- 1 root root 0 Sep 7 2006 Economics
  570. drwxr-xr-x 2 root root 4096 Sep 12 2013 Electronics
  571. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  572. -rw-r--r-- 1 root root 0 Sep 7 2006 Mathematics
  573. -rw-r--r-- 1 root root 0 Sep 7 2006 Medicine
  574. -rw-r--r-- 1 root root 0 Sep 7 2006 Physics
  575. -rw-r--r-- 1 root root 0 Sep 7 2006 Psychology
  576. -rw-r--r-- 1 root root 0 Sep 7 2006 Theory_of_Mind
  577. /home/common/etc/CommonTextKeys/Science/Computer_Science:
  578. -rw-r--r-- 1 root root 0 Sep 7 2006 Artificial_intelligence
  579. -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
  580. -rw-r--r-- 1 root root 0 Sep 7 2006 Internet
  581. -rw-r--r-- 1 root root 0 Sep 7 2006 Java
  582. -rw-r--r-- 1 root root 0 Sep 7 2006 JavaScript
  583. -rw-r--r-- 1 root root 0 Sep 7 2006 Linux
  584. -rw-r--r-- 1 root root 0 Sep 7 2006 Lisp
  585. -rw-r--r-- 1 root root 0 Sep 7 2006 Software_applications
  586. drwxr-xr-x 2 root root 4096 Aug 23 2016 System_Docs
  587. /home/common/etc/CommonTextKeys/Science/Computer_Science/System_Docs:
  588. -rw-r--r-- 1 root root 0 Sep 7 2006 Applications
  589. -rw-r--r-- 1 root root 0 Sep 7 2006 Distros
  590. -rw-r--r-- 1 root root 0 Sep 7 2006 Hardware
  591. -rw-r--r-- 1 root root 0 Sep 7 2006 Internet_Connection
  592. -rw-r--r-- 1 root root 0 Sep 7 2006 System
  593. -rw-r--r-- 1 root root 0 Sep 7 2006 This_PC
  594. /home/common/etc/CommonTextKeys/Science/Electronics:
  595. -rw-r--r-- 1 root root 0 Sep 7 2006 Modules_components
  596. -rw-r--r-- 1 root root 0 Sep 7 2006 Service_manuals
  597. -rw-r--r-- 1 root root 0 Sep 7 2006 Textbooks
  598. Notes:
  599. Preferred text document formats: .epub, .txt, .html, .htm, .odt, .pdf.
  600. There is 'common's software available to browse/show/play/edit/search common libraries.
  601.  
  602. User data
  603. Each user inherits some filesystem 'real estate' in '$COMMON_STORE_DIR/UsersStore':
  604. df -h; echo; ls -l $HOME/Store $DOCUMENTS_DIR/{InetExchange,Multimedia,StoreEtc,StoreTemp};echo;cat $HOME/Store/ReadMe.txt
  605. Filesystem Size Used Avail Use% Mounted on
  606. udev 7.8G 12K 7.8G 1% /dev
  607. tmpfs 1.6G 1.6M 1.6G 1% /run
  608. /dev/sda3 19G 8.5G 9.3G 48% /
  609. none 4.0K 0 4.0K 0% /sys/fs/cgroup
  610. none 5.0M 0 5.0M 0% /run/lock
  611. none 7.8G 79M 7.8G 1% /run/shm
  612. none 100M 24K 100M 1% /run/user
  613. /dev/sda1 509M 3.2M 506M 1% /boot/efi
  614. /dev/sda4 19G 8.7G 9.1G 49% /home
  615. /dev/sda5 3.6T 2.4T 1.3T 66% /home/common/Store
  616.  
  617. lrwxrwxrwx 1 manolo manolo 21 Jul 8 2014 /home/manolo/documents/InetExchange -> ../Store/InetExchange
  618. lrwxrwxrwx 1 manolo manolo 19 Mar 15 2016 /home/manolo/documents/Multimedia -> ../Store/Multimedia
  619. lrwxrwxrwx 1 manolo manolo 12 Jul 8 2014 /home/manolo/documents/StoreEtc -> ../Store/Etc
  620. lrwxrwxrwx 1 manolo manolo 25 Jul 8 2014 /home/manolo/documents/StoreTemp -> ../Store/.ScratchPad/Temp
  621. lrwxrwxrwx 1 manolo manolo 33 Oct 20 2017 /home/manolo/Store -> ../common/Store/UsersStore/manolo
  622.  
  623. UsersStore: This directory is a link to '/home/common/Store/UsersStore/manolo'
  624. UsersStore: It can be used to store bulky files. Contents will be backed up regularly.
  625. UsersStore: (Subdirectory '.ScratchPad' will not be backed up).
  626. UsersStore: Best regards,
  627. UsersStore: Root.
  628.  
  629. **************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement