· 8 years ago · Dec 02, 2017, 11:50 AM
1**************************************************************************************
2COMMON
3**********************
4
5In 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**********************
9Environment
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
21One 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
30Bash script '$SYSTEMLINKS_TO_LINK_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
47Typical '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: 'CommonCronTasks'(Store) already linked to '/home/common'.
55 SystemLinks: 'CommonSettings'(ToLink) already linked to '/home/common/etc'.
56 SystemLinks: 'data'(Store) already linked to '/usr/share/stardict'.
57 SystemLinks: 'Default'(ToLink) already linked to '/etc/mdm/PostLogin'.
58 SystemLinks: 'Default'(ToLink) already linked to '/etc/mdm/PostSession'.
59 SystemLinks: 'dic'(Store) already linked to '/usr/share/stardict'.
60 SystemLinks: 'fstab'(Store) already linked to '/etc'.
61 SystemLinks: 'fstab.EmergencyLinux'(Store) already linked to '/etc'.
62 SystemLinks: 'fstab.ExtEmergencyLinux'(Store) already linked to '/etc'.
63 SystemLinks: 'fstab.MainLinux'(Store) already linked to '/etc'.
64 SystemLinks: 'GraphicalSessionAutostart.desktop'(Store) already linked to '/etc/xdg/autostart'.
65 SystemLinks: 'locale'(Store) already linked to '/etc/default'.
66 SystemLinks: 'mdm.conf'(Store) already linked to '/etc/mdm'.
67 SystemLinks: 'modules'(Store) already linked to '/etc'.
68 SystemLinks: 'profile.local.sh'(ToLink) already linked to '/etc/profile.d'.
69 SystemLinks: 'rc.local'(ToLink) already linked to '/etc'.
70 SystemLinks: 'smartd.conf'(Store) already linked to '/etc'.
71 SystemLinks: 'smartmontools'(Store) already linked to '/etc/default'.
72 SystemLinks: 'SystemLinks'(ToLink) already linked to '/home/common/sbin'.
73 SystemLinks: 'treedict'(Store) already linked to '/usr/share/stardict'.
74 SystemLinks: 'xorg.conf'(Store) already linked to '/etc/X11'.
75}
76
77Some effects of 'SystemLinks' links:
78 -Directory '$COMMON_DIR/UserLocal', in '/home' partition, linked to '/user/local', in '/' partition.
79 ls -l $SYSTEMLINKS_STORE_DIR/local
80 lrwxrwxrwx 1 root root /root/SystemLinks/Store/local -> /home/common/UserLocal
81 ls -l /usr/local
82 lrwxrwxrwx 1 root root /usr/local -> /root/SystemLinks/Store/local
83 # '/user/local' provides, among other things, distro independent binaries I.E.: java.
84 -Bash script 'profile.local.sh' runs (sourced by '/etc/profile') whenever there is a (GUI or otherwise) login,
85 providing users with many environment variables, setting PATH, etc.
86 ls -l /etc/profile.d/profile.local.sh
87 lrwxrwxrwx 1 root root /etc/profile.d/profile.local.sh -> /root/SystemLinks/ToLink/profile.local.sh
88 # Many environment variables have a path as value (if path exists). That, together with bash script 'DefaultApplications'
89 # (see below), provides an EXTRA ABSTRACTION LAYER: Everywhere (scripts, applications, MainMenu...) paths are given as
90 # environment variables and application names as 'Default*'. I.E. 'DefaultFileSystemBrowser $COMMON_JAVA_JARS_DIR'.
91 #
92 # If subdirectory '/home/common/CommonJava/Jars' is moved to '/home/common/Misc/Java_Jars' it is only necessary to change
93 # the value of environment variable $COMMON_JAVA_JARS_DIR (by editing 'profile.local.sh'). If the distro's default filesystem
94 # browser changes from 'nautilus' to 'nemo' it is only necessary to edit 'DefaultApplications' script for everything to work
95 # correctly. Filetypes are also associated to 'Default*' application names ('$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps').
96 #
97 # The above scheme means that 'Default*' applications/commands are always run by invoking bash script 'DefaultApplications'. That
98 # allows individual setting of 'Default*' application/command run conditions: Default options, Allow/don't_allow passing of arguments,
99 # Supress/don't_supress output (for 'noisy' applications), Pre-select (according to passed arguments) pulseaudio's sink and audio
100 # channel volume levels... 'DefaultApplications' bash script removes/creates links to itself if run by 'root'.
101 # See also 'CommonMimeApps' below.
102 -When 'update-grub' runs, it will generate a configuration with the following entries in the grub menu (on top):
103 'Main Linux (Most recent kernel)'
104 'Emergency Linux (Most recent kernel)'
105 'External Sata Linux (Most recent kernel)'
106 ...
107 ls -l /etc/grub.d/07_custom
108 lrwxrwxrwx 1 root root /etc/grub.d/07_custom -> /root/SystemLinks/Store/07_custom
109 -Main 'common's services' files (CommonCron, CommonDaemon common - see below) linked to $COMMON_DIR.
110 -Adds extra processing (encrypting/decrypting, password request, etc.) to GUI session's 'PostLogin' & 'PostSession'.
111 -Inserts configuration files for Linux distro' services, drivers... I.E. smartmontools, ufw, xorg...
112 -Etc.
113
114**********************
115Services
116**********
117
118Main services:
119 -'CommonSystemStartUp'. Bash script. Currently invoked by 'rc.local' (SystemLinks) after system boot.
120 Checks if several (as specified in file 'CommonSettings' - SystemLinks) distro's services are running.
121 Starts main common services:
122 'CommonDaemon' for 'common' (see below).
123 'CommonCron' (see below).
124 Creates $STARTINGUP file and removes it after a few seconds to let applications/services 'know' that system is starting up.
125 Checks Internet connection and creates (or doesn't) files $LOCAL_NETWORK_ON & $INTERNET_CONNECTION_ON.
126 Checks if 'USB controlled power strip' is available and creates (or doesn't) file $USB_CONTROLLED_POWER_STRIP_AVAILABLE.
127 If 'USB controlled power strip' is available it handles switching on/off of 'USB controlled power strip's sockets.
128 'CommonSystemStartUp' sends internal mail to 'root' if problems are detected.
129 Typical 'CommonSystemStartUp' output (from CommonLog): {
130 2017/Mar/20 09:13:38: SystemLinks rc.local: Invoking '/home/common/etc/CommonSystemStartUp'.
131 2017/Mar/20 09:13:38: CommonSystemStartUp: Waiting until 'Usb Controlled PowerStrip' is available.
132 2017/Mar/20 09:13:39: CommonSystemStartUp: 'Usb Controlled PowerStrip' available.
133 2017/Mar/20 09:13:39: CommonSystemStartUp: '$COMMON_MESSAGES_COMMON_DIR' directory cleared.
134 2017/Mar/20 09:13:39: CommonSystemStartUp: '$STARTINGUP' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
135 2017/Mar/20 09:13:39: CommonSystemStartUp: '$COMMON_MESSAGES_SYSTEM_DIR' directory cleared (Except for '$STARTINGUP' & '$DISK_ERROR_WARNING').
136 2017/Mar/20 09:13:39: CommonSystemStartUp: '$USB_CONTROLLED_POWER_STRIP_AVAILABLE' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
137 2017/Mar/20 09:13:39: CommonSystemStartUp: ### Starting Services ###. BEGIN.
138 2017/Mar/20 09:13:40: CommonSystemStartUp: 'CommonDaemon common --start': {
139 2017/Mar/20 09:13:40: CommonDaemon: 'CommonDaemon common' running.
140 2017/Mar/20 09:13:40: }
141 2017/Mar/20 09:13:40:
142 2017/Mar/20 09:13:40: CommonSystemStartUp: 'CommonCron --start': {
143 2017/Mar/20 09:13:40: CommonCron: Starting. Please wait.
144 2017/Mar/20 09:13:40: CommonCron: 'CommonCron' running. Parent's Pid: 2687.
145 2017/Mar/20 09:13:40: }
146 2017/Mar/20 09:13:40: CommonSystemStartUp: ### Starting Services ###. END.
147 2017/Mar/20 09:13:40: ###
148 2017/Mar/20 09:13:40: CommonSystemStartUp: ### Checking Services ###. BEGIN.
149 2017/Mar/20 09:13:40: CommonSystemStartUp: Waiting until 'smartd' daemon (Disk error early warning) is running.
150 2017/Mar/20 09:13:40: CommonSystemStartUp: 'smartd' daemon running.
151 2017/Mar/20 09:13:40:
152 2017/Mar/20 09:13:40: CommonSystemStartUp: Waiting until 'Firewall manager' is enabled.
153 2017/Mar/20 09:13:40: CommonSystemStartUp: 'Firewall manager' enabled.
154 2017/Mar/20 09:13:42: CommonSystemStartUp: 'CheckNetworkConnection -r': {
155 2017/Mar/20 09:13:42: CheckNetworkConnection: Found router address: '192.168.1.1'.
156 2017/Mar/20 09:13:42: CheckNetworkConnection: Router contacted. Network connection On.
157 2017/Mar/20 09:13:42: CheckNetworkConnection: Server contact high (85%). Good Internet connection.
158 2017/Mar/20 09:13:42: CheckNetworkConnection: '$LOCAL_NETWORK_ON' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
159 2017/Mar/20 09:13:42: CheckNetworkConnection: '$INTERNET_CONNECTION_ON' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
160 2017/Mar/20 09:13:42: }
161 2017/Mar/20 09:13:42:
162 2017/Mar/20 09:13:42: CommonSystemStartUp: 'ExternalNetworks_Off' not found in 'CommonSystemStartUpChecksAndServices' variable. Checking skipped.
163 2017/Mar/20 09:13:42: CommonSystemStartUp: ### Checking Services ###. END.
164 2017/Mar/20 09:13:42: CommonSystemStartUp: '$STARTINGUP' removed from '$COMMON_MESSAGES_SYSTEM_DIR'.
165 2017/Mar/20 09:13:51: CommonSystemStartUp: 'OnOff_Monitor': OnOffMainsSocket04(-on): off -> on
166 2017/Mar/20 09:13:51: CommonSystemStartUp: Execution completed.
167 }
168 -'CommonSystemShutdown' (link to 'CommonSystemStartUp' above). Currently invoked by 'shutdown', 'reboot', 'halt' or 'poweroff'
169 ('shutdown' & 'reboot' can be invoked from a GUI session: '$COMMON_BIN_DIR/GuiSystemShutdown' via MainMenu).
170 Creates $SHUTTINGDOWN file so that applications/services 'know' that system is shutting down.
171 Waits until all critical processes (specified in file 'CommonSettings' - SystemLinks) have exited.
172 If 'USB controlled power strip' is available, it handles switching on/off of 'USB controlled power strip's sockets.
173 'CommonSystemShutdown' sends internal mail to 'root' if problems are detected.
174 Typical 'CommonSystemShutdown' output (from CommonLog): {
175 2017/Mar/19 22:52:38: halt(Wrapper): Waiting until 'Usb Controlled PowerStrip' is available.
176 2017/Mar/19 22:52:39: halt(Wrapper): 'Usb Controlled PowerStrip' available.
177 2017/Mar/19 22:52:39: halt(Wrapper): '$SHUTTINGDOWN' sent to '$COMMON_MESSAGES_SYSTEM_DIR'.
178 2017/Mar/19 22:52:39: halt(Wrapper): ### Waiting for critical processes to exit ###. BEGIN.
179 2017/Mar/19 22:52:40: CommonCron --loop: '$SHUTTINGDOWN' detected. Stopping loop.
180 2017/Mar/19 22:52:40: CommonCron --loop: Loop stopped. Exiting.
181 2017/Mar/19 22:52:40: CommonDaemon: 'CommonDaemon common's loop stopped.
182 2017/Mar/19 22:52:41: CommonDaemon: Killing 'CommonDaemon common' background process.
183 2017/Mar/19 22:52:41: halt(Wrapper): ### Waiting for critical processes to exit ###. END.
184 2017/Mar/19 22:52:49: halt(Wrapper): 'OnOff_Monitor': OnOffMainsSocket04(-off): on -> off
185 2017/Mar/19 22:52:49: halt(Wrapper): Invoking '/sbin/shutdown -P now'.
186 2017/Mar/19 22:52:49: halt(Wrapper): Execution completed.
187 }
188 -'CommonCron'. Bash script (does not use distro's 'cron'). Normally started by 'CommonSystemStartUp' (see above) after system boot.
189 Can only be run by 'root' (except when used with option '--running' to find if it is running). It runs 'frequently', and
190 SIMULTANEOUSLY, all required tasks for pseudo-user 'common' (as 'root') and for any other logged-in user (as 'user'). Tasks:
191 frequently (currently every 5 minutes)
192 hourly
193 daily
194 monthly
195 weekly
196 yearly
197 Log files in '$COMMON_VAR_DIR/CommonCron' ('common') & '$HOME_VAR_DIR/CommonCron' (normal user).
198 If one or more task's commands fail, the task log will be mailed to the corresponding user (and also sent to 'CommonLog',
199 see below). Log will include a list of task's commands, highlighting the failed ones. I.E.:
200 ...........................
201 CommonCron.daily: History:
202 - >ArchiveCommonLogs< ExitCode:0.
203 - >RemindAndMailUser< ExitCode:0.
204 - >FileVersions_CriticalFiles< ExitCode:0.
205 - >FileVersions_JavaProjects< ExitCode:0.
206 ! >RewriteLocalApplicationsMenu< ExitCode:69.
207 - >HOMEdotDirsSave< ExitCode:0.
208 ($USER: manolo; $HOME: /home/manolo)
209 CommonCron.daily: Error!
210 CommonCron --help
211 'CommonCron' cycles through a loop continuously and periodically (every 300 seconds) runs,
212 simultaneously, tasks for all logged-in users (logged-in 'root' too) and for pseudo-user 'common'.
213 Tasks to run are specified in '$HOME/CommonCronTasks/CommonCron.*' files for all logged-in users
214 and in '$COMMON_DIR/CommonCronTasks/CommonCron.*' files for pseudo-user 'common'.
215 Above directories and (default) files will be created if they don't exist. Tasks will be run as
216 the corresponding user and with normal log-in environment. Tasks for pseudo-user 'common' will be
217 run as 'root' and with 'HOME=$COMMON_DIR'. Logs will be saved in '$HOME_VAR_DIR/CommonCron' for
218 normal users and in '$COMMON_VAR_DIR/CommonCron' for pseudo-user 'common'.
219 Above directories will be created if they don't exist.
220 Usage:
221 'CommonCron --start' Starts 'CommonCron' (Only 'root').
222 'CommonCron --stop' Stops 'CommonCron' (Only 'root').
223 'CommonCron --running' 'CommonCron' running? (Any user).
224 Notes:
225 Tasks: frequently (every 300 seconds), hourly, daily, monthly, weekly, yearly.
226 'CommonCron' will normaly be started by '$COMMON_ETC_DIR/CommonSystemStartUp' (System boot).
227 'CommonCron' will skip running tasks if file '$STARTINGUP' exists (System startup).
228 'CommonCron' will stop if file '$SHUTTINGDOWN' exists (System shutdown).
229 'CommonCron' will mail task's log to the corresponding user if any of the task's commands
230 fails. Log will include a list of the task's commands, highlighting the failed ones.
231 'CommonCron --running's ExitCodes: 0: Running; 1: Not Running.
232 -'CommonDaemon'. Bash script. General purpose daemon that can be run for any registered user (except 'root') and for
233 pseudo-user 'common' (as 'root'). An instance running for 'common' is normally started by 'CommonSystemStartUp'
234 (see above) after system boot. Current external scripts used in 'CommonDaemon' for 'common':
235 * Conditions * * Actions *
236 CommonAtActionNeeded AskUsersToSwitchPrinterOn
237 NewRunAsRootRequest AskUsersToSwitchPrinterScannerOff
238 PrinterNeedsPower CommonAt
239 PrinterNeedsSwitchingOn DummyAction
240 PrinterOffAndJobsPending NotifyRootMailIfNotCommonCron
241 PrinterScannerIdle RunAsRoot
242 PrinterScannerNeedsSwitchingOff UsbControlledPowerStripServices
243 ScannerNeedsPower
244 UsbControlledPowerStripActionNeeded
245 CommonDaemon --help
246 'CommonDaemon' is a general purpose daemon. It continuously cycles through a loop
247 performing the following actions:
248 -Setting the boolean state of several (Internal and external) defined 'Conditions':
249 Internal:
250 IntNewTime1Hour true at loop start and once every hour.
251 IntNewTime30Minutes true at loop start and once every 30 minutes.
252 IntNewTime10Minutes true at loop start and once every 10 minutes.
253 IntNewTime5Minutes true at loop start and once every 5 minutes.
254 IntNewTime1Minute true at loop start and once every minute.
255 IntNewTime30Seconds true at loop start and once every 30 seconds.
256 IntNewTime10Seconds true at loop start and once every 10 seconds.
257 IntNewTime5Seconds true at loop start and once every 5 seconds.
258 IntNewTime2Seconds true at loop start and once every 2 seconds.
259 Int_NeedToArchiveLogs true when there are too many log files.
260 Int_RequestToStop true if RequestToStop message received.
261 Int_SystemShuttingDown true if SystemShuttingDown message received.
262 Int_SystemStartingUp true if SystemStartingUp message received.
263 Int_TooManyBackgroundChildProcesses true if too many background child processes.
264 Int_TooManyErrorMessages true if too many error messages.
265 Int_NeedToReInitialize true if changes in configuration file or in
266 'Condition' and 'Action' script files.
267 External:
268 Named as the names of files in 'Conditions' directory (See below).
269 -Checking Start_conditions (And launching those whose conditions are met) of several
270 (Internal and external) defined 'Actions':
271 Internal:
272 Int_Initialize Re initializes daemon.
273 Int_StopCommonDaemon Stops daemon's loop (And, later, daemon).
274 Int_ArchiveLogs Creates log files archives in directory
275 '$HOME/var/CommonDaemon/Logs' (See below).
276 External:
277 Named as the names of files in 'Actions' directory (See below).
278 -Checking, every 5 seconds, if background child processes, launched by 'Actions', have
279 finished and logging their process' run info.
280 -Waiting the right time to keep the loop period stable: Wait time depends on work load.
281 Once the daemon's loop has stopped the following actions will take place:
282 -Waiting for background child processes to finish (Timeout configurable) and logging
283 their process' run info.
284 -Killing background child processes still running and logging their process' run info.
285 -Logging daemon script process' info (Daemon has been running in background).
286 'CommonDaemon's Directories:
287 '$HOME/CommonDaemonScripts' 'Condition' & 'Action' forms and configuration file.
288 '$HOME/CommonDaemonScripts/Actions' 'Action' script files subdirectory.
289 '$HOME/CommonDaemonScripts/Conditions' 'Condition' script files subdirectory.
290 '$HOME/var/CommonDaemon/Logs' Log files directory.
291 '$HOME/var/CommonDaemon/tmp' Temporary files directory.
292 Main features of 'CommonDaemon':
293 -Detects '$STARTINGUP' & '$SHUTTINGDOWN' (in $COMMON_MESSAGES_SYSTEM_DIR).
294 -Automatic reinitialization of daemon if changes detected in configuration file
295 or in 'Condition' and 'Action' script files (Checked every 5 seconds).
296 -Checking of Actions' Start_conditions and Conditions' Change_detect_code at
297 (re)initialization.
298 -Loading of Actions' Start_conditions' and Conditions' Change_detect_code into
299 memory, at (re)initialization, to avoid script reading overhead.
300 -Automatic adjustment of loop period/frequency (Configurable) depending on workload.
301 -Automatic archiving of log files (Log files size and archives directory configurable).
302 -Mailing of error messages to user (Configurable).
303 -Automatic daemon's loop stop when: '$SHUTTINGDOWN' detected or too many errors or
304 too many Action's (background launched) child processes (Configurable).
305 -Provides internal 'Conditions' whose boolean values can be used by external 'Action'
306 and 'Condition' scripts.
307 Usage:
308 'CommonDaemon user --start' Starts daemon.
309 'CommonDaemon user --stop' Stops daemon.
310 'CommonDaemon user --running' Checks if daemon is running.
311 Notes:
312 'user' can be any registered user, except 'root', plus pseudo user 'common'.
313 'CommonDaemon user --start|--stop' must be invoked by 'user'.
314 'CommonDaemon common --start|--stop' must be invoked by 'root'. Will run with HOME=$COMMON_DIR.
315 'CommonDaemon user --running' can be invoked by any registered user. ExitCodes:
316 0: Running; 1: Not Running.
317 Please run 'CommonDaemon' and read $HOME/CommonDaemonScripts/*Form for instructions on how
318 to write 'Condition' and 'Action' scripts.
319
320Other services: 'Main services' (above) are used to run, periodically/when conditions change, other services:
321 -Notifying users (mail, system temperatures, process killed...).
322 -Powering on/off of 'USB controlled power strip's sockets (printer/scanner/external_HDs/Monitor/Audio_ampl) when needed.
323 -Allowing some users to run some commands as 'root'.
324 -'At' service (does not use distro's 'at') to run commands at specific times.
325 -Archiving log files.
326 -Simple version control of files.
327 -Backups and syncing of drives (see 'Backup Arrangements' below).
328 -Updating data bases (Text, Audio, Video and movies, Images...).
329 -Temperatures monitoring (issues warnings or even shuts down the system).
330 -Killing of 'Intensive Cpu use' processes.
331 -HD's failure warning (blocks backups and syncing of drives).
332 -'CommonLog' (see details in 'Software' below).
333 -'Reminders' (see details in 'Software' below).
334 ...
335
336**********************
337Software
338**********
339
340 -Administration.
341 -'XSu': (Gui use of 'su') Lets user run a (graphical or otherwise) command as another_user/root if the correct password is given.
342 -Users
343 Create new user using '$COMMON_MISC_DIR/AddUser_Skeleton/*' skeleton.
344 User inherits $HOME directories, MainMenu, configuration, etc according to chosen skeleton.
345 Also reserves 'real state' in bulk storage partition $COMMON_STORE_DIR.
346 Delete user.
347 Update '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps'.
348 Update '$COMMON_MISC_DIR/AddUser_Skeleton/*'.
349 -Commands run before/after GUI session. '/etc/*/PostLogin/Default' & '/etc/*/PostSession/Default' (SystemLinks):
350 Decrypt and mount user's $HOME + other filesystems.
351 archive old '$HOME/.xsession-errors'.
352 Unmount (encrypted) user's $HOME + other filesystems.
353 -Commands run before/after GUI session. '$COMMON_BIN_DIR/GraphicalSessionAutostart' (user configurable):
354 Change desktop font size.
355 Start MainMenu/network monitor, CommonDaemon for user...
356 Stop CommonDaemon for user.
357 -Start Normal GUI session applications '$COMMON_BIN_DIR/StartSessionApplications' (user configurable).
358 -Block/Unblock/Check external networks.
359 -Close GUI session/Shutdown system (from MainMenu).
360 ...
361 -CommonLog
362 '$COMMON_BIN_DIR/CommonLog' used to log messages.
363 Log files in '$COMMON_VAR_DIR/CommonLog' ('root' & 'common') & '$HOME_VAR_DIR/CommonLog' (normal user). It can also log to '/var/log/syslog'.
364 Check 'CommonLog --help'
365 -File version control scripts:
366 -Available to 'common':
367 'FileVersions_CommonBins'
368 'FileVersions_CommonFiles'
369 'FileVersions_CommonJavaProjects'
370 'FileVersions_SystemCriticalFiles'
371 'FileVersions_This_System'
372 -Available to normal users:
373 'FileVersions_CriticalFiles'
374 'FileVersions_CurrentJavaProjects'
375 'FileVersions_JavaProjects'
376 'FileVersions_SecondLifeText'
377 -'At' scripts (using 'At' service):
378 'AlarmTellAt'
379 'At'
380 'AtQueue'
381 'AtRemove' -> 'AtQueue'
382 'MailAt'
383 'TellAt'
384 -Distro independent (Oracle Java in '/home' partition). Java programs:
385 ClassifyTextFiles.jar
386 DetectCharSet.jar
387 Dialog.jar
388 Dialog_CheckList.jar Link to Dialog.jar.
389 Dialog_DirectorySelection.jar Link to Dialog.jar.
390 Dialog_FileSelection.jar Link to Dialog.jar.
391 Dialog_InputText.jar Link to Dialog.jar.
392 Dialog_Message.jar Link to Dialog.jar.
393 Dialog_MessageTimed.jar Link to Dialog.jar.
394 Dialog_RadioList.jar Link to Dialog.jar.
395 FindTextInDocuments.jar
396 JavaSources.jar
397 MainMenuAndNetTraffic.jar
398 PickAndRun.jar
399 PickDirAndRun.jar
400 Reminders.jar
401 SearchAndPlayVideoFiles.jar
402 ShowVideoItemInfo.jar
403 XBeep.jar
404 Java jar files are integrated in 'common's software by bash script '$COMMON_BIN_DIR/RunCommonJavaJar':
405 RunCommonJavaJar --help
406 'RunCommonJavaJar' is a shell wrapper to run Java '*.jar' files. Normal
407 users should not invoke it directly but through a link to it, with the same
408 name (without extension) as the Java jar file, in '$COMMON_JAVA_JARS_DIR',
409 that it should run.
410 If there is a bash script file, in '$COMMON_JAVA_JARS_DIR', with the same name
411 as the jar file, it will be run first to find out which extra java interpreter
412 options are needed to run the java application.
413 Environment variables exported before launching Java application:
414 'invokationPath' is set to the invoking link (Same as '$0' in bash).
415 'DISPLAY' is set to the value of '--display' option (if supplied). Note:
416 Java applications, using a '--display' option, must check the option and
417 'DISPLAY' environment variable and generate appropriate error messages.
418 When run by root, 'RunCommonJavaJar' will update the links available to run
419 common Java '*.jar' files.
420 Current links to this script:
421 'ClassifyTextFiles.jar': 'ClassifyTextFiles -> RunCommonJavaJar'.
422 'DetectCharSet.jar': 'DetectCharSet -> RunCommonJavaJar'.
423 'Dialog_CheckList.jar': 'Dialog_CheckList -> RunCommonJavaJar'.
424 'Dialog_DirectorySelection.jar': 'Dialog_DirectorySelection -> RunCommonJavaJar'.
425 'Dialog_FileSelection.jar': 'Dialog_FileSelection -> RunCommonJavaJar'.
426 'Dialog_InputText.jar': 'Dialog_InputText -> RunCommonJavaJar'.
427 'Dialog.jar': 'Dialog -> RunCommonJavaJar'.
428 'Dialog_Message.jar': 'Dialog_Message -> RunCommonJavaJar'.
429 'Dialog_MessageTimed.jar': 'Dialog_MessageTimed -> RunCommonJavaJar'.
430 'Dialog_RadioList.jar': 'Dialog_RadioList -> RunCommonJavaJar'.
431 'FindTextInDocuments.jar': 'FindTextInDocuments -> RunCommonJavaJar'.
432 'JavaSources.jar': 'JavaSources -> RunCommonJavaJar'.
433 'Java_XChartDemo.jar': 'Java_XChartDemo -> RunCommonJavaJar'.
434 'MainMenuAndNetTraffic.jar': 'MainMenuAndNetTraffic -> RunCommonJavaJar'.
435 'PickAndRun.jar': 'PickAndRun -> RunCommonJavaJar'.
436 'PickDirAndRun.jar': 'PickDirAndRun -> RunCommonJavaJar'.
437 'Reminders.jar': 'Reminders -> RunCommonJavaJar'.
438 'SearchAndPlayVideoFiles.jar': 'SearchAndPlayVideoFiles -> RunCommonJavaJar'.
439 'ShowVideoItemInfo.jar': 'ShowVideoItemInfo -> RunCommonJavaJar'.
440 'XBeep.jar': 'XBeep -> RunCommonJavaJar'.
441 -Java program 'MainMenuAndNetTraffic' started (see '$COMMON_BIN_DIR/GraphicalSessionAutostart' above) for
442 user after GUI login. 'MainMenuAndNetTraffic' shows, in a multi-level menu, *.desktop files in $HOME/.MainMenu
443 and also displays system's networks' trafic in its window's name.
444 -Java program 'Reminders' lets users set/view reminders and, together with services 'CommonCron' & 'At' (see above)
445 and java program 'Dialog_*', can be used to remind users daily.
446 -Applications to classify/browse/show/play/edit/search 'Common libraries' items (see below).
447 -All kinds of bash scripts and some application wrappers in $COMMON_BIN_DIR and $COMMON_SBIN_DIR.
448 Use 'BrowsePATH' to see which commands are available in the above directories: BrowsePATH --help
449 'BrowsePATH' lists executables available in PATH directories.
450 Usage: 'BrowsePATH' (Current user's PATH).
451 or
452 Usage: 'BrowsePATH --root' (root's PATH).
453
454**********************
455Data
456**********
457
458Common data
459 Encrypted data in $COMMON_DATA_DIR
460 Multimedia in $COMMON_MULTIMEDIA_DIR
461 Audio files in $COMMON_AUDIO_DIR
462 Video files in $COMMON_VIDEO_DIR
463 Image files in $COMMON_IMAGES_DIR
464 Common libraries in $COMMON_TEXT_DIR
465 Common libraries includes all types of documents in different formats, including
466 'bundles': archives including data and instructions on how to treat that data.
467 Multimedia (Audio, Video, Images) is also included in the libraries. Items are
468 sorted, in $COMMON_TEXT_DIR, by author and by categories as defined in
469 '$COMMON_ETC_DIR/CommonTextKeys': ls -lR $COMMON_ETC_DIR/CommonTextKeys
470 /home/common/etc/CommonTextKeys:
471 -rw-r--r-- 1 root root 0 Sep 7 2006 Biographies
472 -rw-r--r-- 1 root root 0 Sep 7 2006 Economy
473 drwxr-xr-x 2 root root 4096 Oct 3 2016 Etc
474 drwxr-xr-x 3 root root 4096 Nov 28 2014 Fiction
475 drwxr-xr-x 3 root root 4096 Mar 6 2007 History
476 -rw-r--r-- 1 root root 0 Sep 7 2006 Philosophy
477 drwxr-xr-x 4 root root 4096 Jan 28 2016 Science
478 -rw-r--r-- 1 root root 0 Sep 7 2006 Travel
479 -rw-r--r-- 1 root root 0 Sep 7 2006 Unclassified
480 /home/common/etc/CommonTextKeys/Etc:
481 -rw-r--r-- 1 root root 0 Sep 7 2006 Audio_Database
482 -rw-r--r-- 1 root root 0 Sep 7 2006 Dictionaries_Encyclopedias_Book_lists
483 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
484 -rw-r--r-- 1 root root 0 Sep 7 2006 Film_reviews
485 -rw-r--r-- 1 root root 0 Sep 7 2006 Images_Database
486 -rw-r--r-- 1 root root 0 Sep 7 2006 User_manuals_and_service_guides
487 -rw-r--r-- 1 root root 0 Sep 7 2006 Video_Database
488 /home/common/etc/CommonTextKeys/Fiction:
489 -rw-r--r-- 1 root root 0 Sep 7 2006 Comedy
490 -rw-r--r-- 1 root root 0 Sep 7 2006 Crime_Action
491 -rw-r--r-- 1 root root 0 Sep 7 2006 Erotism
492 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
493 -rw-r--r-- 1 root root 0 Sep 7 2006 Fantasy
494 drwxr-xr-x 3 root root 4096 Mar 6 2007 Historical_Novel
495 -rw-r--r-- 1 root root 0 Sep 7 2006 Mistery
496 -rw-r--r-- 1 root root 0 Sep 7 2006 Paranormal
497 -rw-r--r-- 1 root root 0 Sep 7 2006 Poetry
498 -rw-r--r-- 1 root root 0 Sep 7 2006 Religion
499 -rw-r--r-- 1 root root 0 Sep 7 2006 Romance
500 -rw-r--r-- 1 root root 0 Sep 7 2006 Science_Fiction
501 -rw-r--r-- 1 root root 0 Sep 7 2006 Short_stories
502 -rw-r--r-- 1 root root 0 Sep 7 2006 Social_Fiction
503 -rw-r--r-- 1 root root 0 Sep 7 2006 Tales_and_Legends
504 -rw-r--r-- 1 root root 0 Sep 7 2006 Terror
505 -rw-r--r-- 1 root root 0 Sep 7 2006 Theatre
506 -rw-r--r-- 1 root root 0 Sep 7 2006 Travel
507 /home/common/etc/CommonTextKeys/Fiction/Historical_Novel:
508 -rw-r--r-- 1 root root 0 Sep 7 2006 1453CE-1789CE
509 -rw-r--r-- 1 root root 0 Sep 7 2006 1789CE-Today
510 drwxr-xr-x 2 root root 4096 Mar 6 2006 4000BCE-476CE
511 -rw-r--r-- 1 root root 0 Sep 7 2006 476CE-1453CE
512 -rw-r--r-- 1 root root 0 Sep 7 2006 Before_4000BCE
513 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
514 /home/common/etc/CommonTextKeys/Fiction/Historical_Novel/4000BCE-476CE:
515 -rw-r--r-- 1 root root 0 Sep 7 2006 Egypt
516 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
517 -rw-r--r-- 1 root root 0 Sep 7 2006 Greece
518 -rw-r--r-- 1 root root 0 Sep 7 2006 Rome
519 /home/common/etc/CommonTextKeys/History:
520 -rw-r--r-- 1 root root 0 Sep 7 2006 1453CE-1789CE
521 -rw-r--r-- 1 root root 0 Sep 7 2006 1789CE-Today
522 drwxr-xr-x 2 root root 4096 Mar 6 2006 4000BCE-476CE
523 -rw-r--r-- 1 root root 0 Sep 7 2006 476CE-1453CE
524 -rw-r--r-- 1 root root 0 Sep 7 2006 Before_4000BCE
525 /home/common/etc/CommonTextKeys/History/4000BCE-476CE:
526 -rw-r--r-- 1 root root 0 Sep 7 2006 Egypt
527 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
528 -rw-r--r-- 1 root root 0 Sep 7 2006 Greece
529 -rw-r--r-- 1 root root 0 Sep 7 2006 Rome
530 /home/common/etc/CommonTextKeys/Science:
531 -rw-r--r-- 1 root root 0 Sep 7 2006 Alternative_medicine
532 -rw-r--r-- 1 root root 0 Sep 7 2006 Architecture
533 -rw-r--r-- 1 root root 0 Sep 7 2006 Astronomy
534 -rw-r--r-- 1 root root 0 Sep 7 2006 Biology
535 -rw-r--r-- 1 root root 0 Sep 7 2006 Chemistry
536 drwxr-xr-x 3 root root 4096 Oct 5 2013 Computer_Science
537 -rw-r--r-- 1 root root 0 Sep 7 2006 Cosmology
538 -rw-r--r-- 1 root root 0 Sep 7 2006 Earth_Sciences
539 -rw-r--r-- 1 root root 0 Sep 7 2006 Economics
540 drwxr-xr-x 2 root root 4096 Sep 12 2013 Electronics
541 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
542 -rw-r--r-- 1 root root 0 Sep 7 2006 Mathematics
543 -rw-r--r-- 1 root root 0 Sep 7 2006 Medicine
544 -rw-r--r-- 1 root root 0 Sep 7 2006 Physics
545 -rw-r--r-- 1 root root 0 Sep 7 2006 Psychology
546 -rw-r--r-- 1 root root 0 Sep 7 2006 Theory_of_Mind
547 /home/common/etc/CommonTextKeys/Science/Computer_Science:
548 -rw-r--r-- 1 root root 0 Sep 7 2006 Artificial_intelligence
549 -rw-r--r-- 1 root root 0 Sep 7 2006 Etc
550 -rw-r--r-- 1 root root 0 Sep 7 2006 Internet
551 -rw-r--r-- 1 root root 0 Sep 7 2006 Java
552 -rw-r--r-- 1 root root 0 Sep 7 2006 JavaScript
553 -rw-r--r-- 1 root root 0 Sep 7 2006 Linux
554 -rw-r--r-- 1 root root 0 Sep 7 2006 Lisp
555 -rw-r--r-- 1 root root 0 Sep 7 2006 Software_applications
556 drwxr-xr-x 2 root root 4096 Aug 23 2016 System_Docs
557 /home/common/etc/CommonTextKeys/Science/Computer_Science/System_Docs:
558 -rw-r--r-- 1 root root 0 Sep 7 2006 Applications
559 -rw-r--r-- 1 root root 0 Sep 7 2006 Distros
560 -rw-r--r-- 1 root root 0 Sep 7 2006 Hardware
561 -rw-r--r-- 1 root root 0 Sep 7 2006 Internet_Connection
562 -rw-r--r-- 1 root root 0 Sep 7 2006 System
563 -rw-r--r-- 1 root root 0 Sep 7 2006 This_PC
564 /home/common/etc/CommonTextKeys/Science/Electronics:
565 -rw-r--r-- 1 root root 0 Sep 7 2006 Modules_components
566 -rw-r--r-- 1 root root 0 Sep 7 2006 Service_manuals
567 -rw-r--r-- 1 root root 0 Sep 7 2006 Textbooks
568 There is 'common's software available to browse/show/play/edit/search common libraries.
569
570User data
571 Each user inherits some filesystem 'real state' in '$COMMON_STORE_DIR/UsersStore'. Example:
572 cat $HOME/Store/ReadMe.txt
573 UsersStore: This directory is a link to '/home/common/Store/UsersStore/manolo'
574 UsersStore: It can be used to store bulky files. Contents will be backed up regularly.
575 UsersStore: (Subdirectory '.ScratchPad' will not be backed up).
576 UsersStore: Best regards,
577 UsersStore: Root.
578 cd $DOCUMENTS_DIR; ls -l InetExchange Multimedia StoreEtc StoreTemp
579 lrwxrwxrwx 1 manolo manolo 21 Jul 8 2014 InetExchange -> ../Store/InetExchange
580 lrwxrwxrwx 1 manolo manolo 19 Mar 15 2016 Multimedia -> ../Store/Multimedia
581 lrwxrwxrwx 1 manolo manolo 12 Jul 8 2014 StoreEtc -> ../Store/Etc
582 lrwxrwxrwx 1 manolo manolo 25 Jul 8 2014 StoreTemp -> ../Store/.ScratchPad/Temp
583
584**************************************************************************************
585List of installed packages
586**********************
587
588List, together with apt trusted keys ('apt-key exportall'), saved daily with '$COMMON_SBIN_DIR/SaveInstalledPackagesInfo'.
589Read 'man dpkg', options: '--get-selections' & '--set-selections'
590
591To reinstall:
592 First make sure that sources lists are correct (/etc/apt/sources.list* - regularly saved by $COMMON_SBIN_DIR/FileVersions_SystemCriticalFiles)
593 sudo apt-key add $COMMON_VAR_DIR/apt.keys
594 sudo apt-get update
595 sudo apt-get install dselect
596 sudo dselect update
597 sudo dpkg --set-selections < $COMMON_VAR_DIR/apt.installed_packages
598 sudo apt-get dselect-upgrade -y
599
600Note:
601 May have to update dpkg's list of available packages or it will just ignore your selections (debian bug).
602 If bug not fixed in current distro, do this before sudo 'dpkg --set-selections ...' above:
603 apt-cache dumpavail > ~/temp_avail
604 sudo dpkg --merge-avail ~/temp_avail
605 rm ~/temp_avail
606
607**************************************************************************************
608CommonMimeApps
609**********************
610
611User 'manolo' should maintain '$HOME/.local/share/applications' by editing manually '$HOME/.local/share/applications/mimeapps.list'
612and using script '$HOME_BIN_DIR/CreateDotLocalShareApplicationDesktops'.
613
614'$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps/.local/share/applications' should be updated, using '$COMMON_SBIN_DIR/Sync_CommonMimeApps'
615(MainMenu), (whole */applications directory copied) by user 'manolo' after any changes in his '$HOME/.local/share/applications'.
616
617'$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps/.local/share/applications' will be used as reference in '$COMMON_SBIN_DIR/UDir_CommonMimeApps'
618to update '$COMMON_MISC_DIR/AddUser_Skeleton/*/.local/share/applications' and '/root/*/.local/share/applications'.
619'$COMMON_SBIN_DIR/RunIfChanges_UDir_CommonMimeApps' will be run by 'CommonCron common weekly' (calling '$COMMON_SBIN_DIR/UDir_CommonMimeApps').
620
621Other users may include a call to '$COMMON_BIN_DIR/UDir_Local_CommonMimeApps' in their 'CommonCron user daily' (normally commented out) to
622update their local '$HOME/.local/share/applications' using '$COMMON_APPLICATION_DEFAULTS_DIR/CommonMimeApps/.local/share/applications' as reference.
623
624Notes:
625 Files '$HOME/.local/share/applications/mimeapps.list, defaults.list' have been deprecated. In modern distros there should be only one file:
626 '$HOME/.config/mimeapps.list'. The above scheme is still used with links to '$HOME/.local/share/applications/mimeapps.list':
627 '$HOME/.config/mimeapps.list' & '$HOME/.local/share/applications/defaults.list'.
628 Links '*/.config/mimeapps.list' not created by above scripts so they have been added, manually:
629 '/root/.config/mimeapps.list'
630 '$COMMON_MISC_DIR/AddUser_Skeleton/*/.config/mimeapps.list'
631
632**************************************************************************************
633Head parking in Western Digital Green HDs
634**********************
635
636Western Digital Green hard drives have a serious issue when used in Linux as a main drive or as a NAS drive.
637The problem is due to a feature called IntelliPark. Which parks the heads on the drive after 8secs of drive inactivity.
638Many Linux installations write to the file system a few times a minute in the background (eg. writing logs). As a result,
639there may be 100 or more load cycles per hour, and the load cycle rating (the drives are good for 300,000 Load/unload cycles)
640may be exceeded in less than a year. This problem also makes the drives very unresponsive and makes your system feel
641slow as the heads need to be unparked when you try and load something.
642
643Check Load_Cycle_Count (as root):
644 smartctl -A /dev/sda | grep "^193"
645 193 Load_Cycle_Count 0x0032 088 088 000 Old_age Always - 337763
646 If the Load cycle count exceeds a few thousand, you're affected by the idle3 timer problem.
647 (337763: Rather late than never :-( )
648
649To solve the problem:
650 Install (with Synaptic) idle3-tools
651 Check timer setting:
652 idle3ctl -g /dev/sdb
653 Idle3 timer set to 80 (0x50)
654 Confirms that timer is set to 8 seconds (80)
655 Disable timer:
656 idle3ctl -d /dev/sdb
657 Idle3 timer disabled
658 Please power cycle your drive off and on for the new setting to be taken into account. A reboot will not be enough!
659 Power down/up system and check again:
660 idle3ctl -g /dev/sdb
661 Idle3 timer is disabled
662
663**************************************************************************************
664CommonLog
665**********************
666
667Use $COMMON_BIN_DIR/CommonLog to log messages:
668 Check 'CommonLog --help'
669
670'CommonLog' can also log to /var/log/syslog. If common scripts and applications only use
671'CommonLog' if the distro syslog changes it will only be necessary to modify 'CommonLog'.
672
673Some times it can be tricky to close all 'CommonLog' and 'tee' pipes when a script exits
674and it will be better to duplicate 'echo ...' with 'echo ... | CommonLog' and 'echoE ...'
675with 'echo -e ... | CommonLog'.
676
677**************************************************************************************
678Integrating Audiobooks in $COMMON_TEXT_DIR
679**********************
680
681-Convert mp3 files to ogg Vorbis: quality: Normal (Nominal bitrate: 128 kb/s).
682-Edit Metadata
683 title 01/Disc01/Chapter01...
684 artist Book Author (FamilyName, Name. I.E.: Adams, Douglas)
685 album Book name
686 genre Audiobooks
687 tracknumber 01
688 Notes:
689 Remove 'Art' metadata! (if everything else fails use vorbiscomment)
690 Run RenameAudioFiles -t DirectoryWithOggFiles
691-Create Zip archive (Name ended in '__AUDIO'):
692 Hitchhiker_s_Guide_to_the_Galaxy__AUDIO.en43848.zip
693 CommandInZip
694 Hitchhiker_s_Guide_to_the_Galaxy/
695 All.m3u
696 Disc01.ogg
697 Disc02.ogg
698 Disc03.ogg
699 Disc04.ogg
700 Disc05.ogg
701 Notes:
702 Use $COMMON_BIN_DIR/ClassifyTextFiles to classify Zip archive (en43848)
703 All.m3u:
704 #EXTM3U
705 Disc01.ogg
706 Disc02.ogg
707 Disc03.ogg
708 Disc04.ogg
709 Disc05.ogg
710 CommandInZip:
711 RunMultipleCommands ln -s -f $PWD/Hitchhiker_s_Guide_to_the_Galaxy ${HOME}_ PlayAudioFilesList $HOME/Hitchhiker_s_Guide_to_the_Galaxy # Directory name in zip archive
712
713-Create/modify_contents of audiobook author in $COMMON_TEXT_DIR/.Store/Authors/Books
714 Adams_Douglas
715 Zips # Create if necessary
716 Hitchhiker_s_Guide_to_the_Galaxy__AUDIO.en43848.zip # Zip archive created above
717 HHGTTG00_Hitchhiker_Guide_to_the_Galaxy.en43848.abw # Try to get the text version of the audio book!
718 Hitchhiker_s_Guide_to_the_Galaxy__AUDIO.en43848.zipsh # Created by $COMMON_SBIN_DIR/ClassifyCommonText
719 ......................
720 .Sources.tar.bz2
721
722**************************************************************************************
723Using MainMenuAndNetTraffic
724**********************
725Files:
726 $COMMON_BIN_DIR/MainMenuAndNetTraffic -> RunCommonJavaJar
727 $HOME/.MainMenu
728SystemLinks
729 $SYSTEMLINKS_DIR/Store/GraphicalSessionAutostart.desktop linked to /etc/xdg/autostart
730 runs $COMMON_BIN_DIR/GraphicalSessionAutostart
731
732**************************************************************************************
733systemd
734**********************
735Running $COMMON_ETC_DIR/CommonSystemStartUp after system startup sequence is complete.
736***********
737
738cat $SYSTEMLINKS_STORE_DIR/CommonSystemStartUp.service: {
739[Unit]
740 Description=CommonSystemStartUp
741 ConditionPathExists=/home/common/etc/CommonSystemStartUp
742
743[Service]
744 Type=forking
745 ExecStart=/home/common/etc/CommonSystemStartUp start
746 TimeoutSec=0
747 StandardOutput=tty
748 RemainAfterExit=yes
749 SysVStartPriority=99
750
751[Install]
752 WantedBy=multi-user.target
753}
754
755cat $SYSTEMLINKS_TO_LINK_DIR/CommonSystemStartUp.service: {
756#Written by Manuel Iglesias. glesialo@gmail.com
757#
758#SystemDirectory=/etc/systemd/system
759#SystemDirectory=/etc/systemd/system/multi-user.target.wants
760#InStore
761#
762#-File in $SYSTEMLINKS_STORE_DIR should be linked to its corresponding Directories (see above).
763}
764
765SystemLinks: 'CommonSystemStartUp.service'(Store) already linked to '/etc/systemd/system'.
766SystemLinks: 'CommonSystemStartUp.service'(Store) already linked to '/etc/systemd/system/multi-user.target.wants'.
767
768# Enable the service (Really necessary?) on system boot:
769sudo systemctl enable CommonSystemStartUp
770Output:
771 Created symlink from /etc/systemd/system/multi-user.target.wants/CommonSystemStartUp.service to /etc/systemd/system/CommonSystemStartUp.service.
772
773# Now start the service and check its status:
774sudo systemctl start CommonSystemStartUp.service
775sudo systemctl status CommonSystemStartUp.service
776Output:
777 CommonSystemStartUp.service - CommonSystemStartUp
778 Loaded: loaded (/etc/systemd/system/CommonSystemStartUp.service; enabled; vendor preset: enabled)
779 Active: active (running) since Fri 2015-11-27 00:32:56 CST; 14min ago
780 Process: 879 ExecStart=/home/common/etc/CommonSystemStartUp start (code=exited, status=0/SUCCESS)
781 Main PID: 880 (watch)
782 CGroup: /system.slice/CommonSystemStartUp.service
783
784************************************************
785Running $COMMON_ETC_DIR/CommonSystemShutdown before system shutdown sequence starts.
786***********
787
788(SystemLinks) /etc/systemd/system/shutdown.target/CommonSystemShutdown.service:
789
790[Unit]
791Description=CommonSystemShutdown
792DefaultDependencies=no
793Before=shutdown.target reboot.target halt.target
794
795[Service]
796ExecStart=/home/common/etc/CommonSystemShutdown
797Type=oneshot
798
799Or /etc/systemd/system/CommonSystemShutdown.service:
800
801[Unit]
802Description=CommonSystemShutdown
803
804[Service]
805Type=oneshot
806ExecStart=/home/common/etc/CommonSystemShutdown
807RemainAfterExit=yes
808
809[Install]
810WantedBy=shutdown.target
811
812**************************************************************************************
813Firewall
814**********************
815
816Router port forwarding:
817 Read $COMMON_DIR/Etc/Router/Router.txt
818 Amule: Ports 4661,4672
819 Transmission: 51413,51413
820 Note: See screenshots in System_Docs/Internet_Connection/{root_Internet_Connection}Forwarding_of_Router_Ports_ScreenShots{English}.zipsh
821
822The Linux kernel includes a firewall (netfilter/iptables) that's off by default.
823Can be switched on and configured by '/usr/sbin/ufw' (ufw GUI: '/usr/sbin/gufw').
824
825-Currently firewall manager 'ufw' is enabled/disabled at boot by $COMMON_ETC_DIR/CommonSystemStartUp
826 and 'ufw's configuration file, '/etc/ufw/ufw.conf', is NO longer in SystemLinks. Logging is currently turned off
827 also by $COMMON_ETC_DIR/CommonSystemStartUp (see logging below).
828-Configuration includes 'allowing' ports for 'amule' and 'transmission' (see $COMMON_DIR/SystemDocs/Etc/Router/Router.txt).
829-If 'ufw's logging is on, 'ufw' logs everywhere: /var/log/kern.log,/var/log/messages,/var/log/syslog,/var/log/ufw.log.
830 Even with log level set to 'low' there are many 'block' messages that normally (checked in Inet) do not mean trouble.
831 Currently 'ufw's logging is off.
832
833Forwarding of ports Firewall (run gufw):
834 Edit/Reset Current Profile (Remove all current rules)
835 Add new rule (Rules +)
836 Application: Amule Allow ports 4662 & 4672 (Make sure Amule client uses the same ports)
837 Add new rule (Rules +)
838 Application: Transmission Allow port 51413 (Make sure Transmission client uses the same port)
839
840 Note: See screenshots in System_Docs/Internet_Connection/{root_Internet_Connection}Forwarding_of_Router_Ports_ScreenShots{English}.zipsh
841
842**************************************************************************************
843SMART Disk Monitoring Daemon
844**********************
845
846To start/stop 'smartd' daemon, at system start/shutdown, file '/etc/default/smartmontools' must be modified.
847Currently '/etc/default/smartmontools' & '/etc/smartd.conf' are in SystemLinks.
848
849'smartd' logs into /var/log/syslog
850
851By default (See part of '/etc/smartd.conf' below) 'smartd' runs '/usr/share/smartmontools/smartd-runner' in case of serious disk errors.
852'smartd-runner' runs scripts in '/etc/smartmontools/run.d'. One of them is '10mail' which will send mail to root.
853
854Have decided not to use '/usr/share/smartmontools/smartd-runner'. 'smartd' now invokes '/home/common/etc/DiskErrorsWarning'.
855'$COMMON_ETC_DIR/DiskErrorsWarning' takes care of:
856 Adding 'smartctl' output to 'smartd's EMail's body.
857 Sending mail to the addresses supplied in '/etc/smartd.conf'.
858 Create file $DISK_ERROR_WARNING (will stop CommonCron's backups to avoid making backups of corrupted data).
859 Notifying NotifyRootMail_Users + root (or all logged in users if NotifyRootMail_Users can't be read) that there are Disk errors.
860 Logging to CommonLog
861Note:
862 -$COMMON_ETC_DIR/CommonSystemStartUp detects if 'smartd' is running. If it isn't, CommonSystemStartUp,
863 sends an EMail to root. It will not remove $DISK_ERROR_WARNING file. Once the file is created it must
864 be removed manually (after replacing the faulty drive).
865
866Emails to root & '/etc/smartmontools/run.d' scripts tested by temporarily changing '/etc/smartd.conf's line:
867 #DEVICESCAN -m root -M exec /usr/share/smartmontools/smartd-runner # Original line
868 DEVICESCAN -m root -M exec /home/common/etc/DiskErrorsWarning -M test # For test purposes
869 #DEVICESCAN -m root -M exec /home/common/etc/DiskErrorsWarning # Normal line
870and running (as root)
871 /etc/init.d/smartmontools restart
872It can also be tested by running (as root):
873 echo "EMail message body" | $COMMON_ETC_DIR/DiskErrorsWarning -s "EMail subject" "EMailTo list"
874Notes:
875 -In '/etc/smartd.conf's '-m root', 'root' is the 'EMailTo list', if there are more than one EMail recipients,
876 each name must be separated by commas. I.E.: '-m root,manolo'
877 -When testing, 'smartd' will run once per monitored drive (I.E.: /dev/sda, /dev/sdb).
878 -Had to close StdIn & StdErr in DiskErrorsWarning so that 'smartd' doesn't wait until
879 all children processes have exited.
880 -Check 'man smartd.conf' for local scripts details.
881 -Read comments in $COMMON_ETC_DIR/DiskErrorsWarning
882!!-Once running, make sure that smartctl is ON for all drives (some combinations USB/Drive_brand do not work):
883 smartctl -a /dev/sda;smartctl -a /dev/sda
884 Check /var/log/syslog messages like:
885 Nov 19 13:31:56 Linux-2 smartd[1859]: Device: /dev/sda [SAT], SMART Prefailure Attribute: 1 Raw_Read_Error_Rate changed from 110 to 108
886 Nov 19 13:31:56 Linux-2 smartd[1859]: Device: /dev/sda [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 74 to 73
887 Nov 19 13:31:56 Linux-2 smartd[1859]: Device: /dev/sda [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 26 to 27
888 Nov 19 13:31:56 Linux-2 smartd[1859]: Device: /dev/sda [SAT], SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 34 to 31
889 Nov 19 13:31:57 Linux-2 smartd[1859]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 125 to 124
890
891**************************************************************************************
892
893**************************************************************************************
894To run *.jar files automatically as executable
895**********************
896
897!!Java jar files are associated to 'java -jar' command via 'binfmt-support' package.
898
899Note: 'update-binfmts' not convenient to use when Java installed manually.
900 Currently using shell wrappers (See $COMMON_BIN_DIR/ClassifyTextFiles and its links)
901 for jar files in $COMMON_JAVA_JARS_DIR
902
903**************************************************************************************
904How to control fan speed?
905**********************
906
9071. Install lm-sensors and fancontrol packages
908
9092. Configure lm-sensors
910 a) In terminal type sudo sensors-detect and answer YES to all YES/no questions.
911 b) At the end of sensors-detect, a list of modules that needs to be loaded will displayed.
912 Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.
913 c) Run sudo /etc/init.d/module-init-tools restart This will read the changes you made to /etc/modules in
914 step 3, and insert the new modules into the kernel.
915
9163. Configure fancontrol
917 a) In terminal type sudo pwmconfig . This script will stop each fan for 5 seconds to find out which fans
918 can be controlled by which PWM handle. After script loops trought all fans, you can configure which fan
919 corresponds to which temperature.
920 b) In my case I set interval to 2 seconds.
921
9224. Run fancontrol
923 a) sudo fancontrol and leave it open in console,
924
925In my case for CPU I used:
926 Settings for hwmon0/device/pwm2:
927 Depends on hwmon0/device/temp2_input
928 Controls hwmon0/device/fan2_input
929 MINTEMP=40
930 MAXTEMP=60
931 MINSTART=150
932 MINSTOP=0
933 MINPWM=0
934 MAXPWM=255
935
936**************************************************************************************
937deluser
938**********************
939#!!Note: recent version of 'deluser' fails with 'user username is currently logged in'
940After deleting snormal & sspecial (which will give above error) run twice:
941 /usr/sbin/userdel --force snormal
942 /usr/sbin/userdel --force sspecial
943
944So that if you Run:
945 IsRegisteredUser snormal; echo $?
946 IsRegisteredUser sspecial; echo $?
947It exits with 1 in both cases.
948
949Don't forget to remove deleted users' directories in $COMMON_STORE_DIR/UsersStore
950
951**************************************************************************************
952
953**************************************************************************************
954Number Keypad
955**********************
956!! If BloqNum works but numbers in number keypad are not read for just one user. Replace $HOME/.gconf $HOME/.gconfd (From backups)
957
958**************************************************************************************
959Limiting process resources
960**********************
961Bash directive -ulimit sets limits to resources used by a shell script and all its child processes.
962Example:
963
964..........
965#1GB limit of virtual memory use
966ulimit -v 1048576
967$OriginalProgram "$@"
968
969**************************************************************************************
970Runlevels /etc/init, /etc/rc?.d.
971**********************
972
973/etc/rc.local is executed at the end of each multiuser runlevel (i.e after boot).
974
975**************************************************************************************
976Very important notes.
977**********************
978{
979To Install_UbuntuLinux/Partition_a_disk:
980In Ubuntu Installer answer 'boot:' with 'expert'.
981When partitioning select: Partition table type MsDos.
982Don't forget to make '/' partition bootable.
983}
984
985**************************************************************************************
986Backup Arrangement.
987**********************
988
989Scripts for easier use of 'dar' {
990 Bkp_Home Backup to $COMMON_STORE_DIR (MainLinux) # Base '/', home
991 Bkp_UserLocal Backup to $COMMON_STORE_DIR (MainLinux) # Base '/', ${COMMON_DIR#/}/UserLocal (SystemLinks -> /usr/local)
992 Bkp_System Backup to $COMMON_STORE_DIR (MainLinux) # Base '/', all
993 Bkp_Text Backup to $COMMON_STORE_DIR (MainLinux) # Base '/', ${COMMON_TEXT_DIR#/}
994 TestBackups_Common Integrity test of all backups in $COMMON_BACKUPS_THIS_DRIVE (If Drive is configured as MainLinux)
995 Also {
996 RunIfChanges_Bkp_UserLocal
997 RunIfChanges_Bkp_System
998 RunIfChanges_Bkp_Text # Runs ClassifyCommonText and then Bkp_Text. Use before UDir_Text/RunIfChanges_UDir_Text!
999 }
1000}
1001
1002Scripts for easier use of 'rsync' {
1003 UDir_System Backup to $EMERGENCY_LINUX_ROOT_DIR Link UDir_SystemExt Backup to $EXTERNAL_EMERGENCY_LINUX_ROOT_DIR
1004 UDir_Root Backup to $EMERGENCY_LINUX_ROOT_DIR Link UDir_RootExt Backup to $EXTERNAL_EMERGENCY_LINUX_ROOT_DIR
1005 UDir_Store Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_StoreExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR # Etc & Temp_Skeleton
1006 UDir_Data Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_DataExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR
1007 UDir_CriticalData Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_CriticalDataExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR
1008 UDir_DiffBackups Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_DiffBackupsExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR
1009 UDir_Multimedia Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_MultimediaExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR
1010 UDir_Text Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_TextExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR
1011 UDir_UsersStore Backup to $EMERGENCY_LINUX_STORE_DIR Link UDir_UsersStoreExt Backup to $EXTERNAL_EMERGENCY_LINUX_STORE_DIR
1012 UDir_Home Backup to $EMERGENCY_LINUX_HOME_DIR Link UDir_HomeExt Backup to $EXTERNAL_EMERGENCY_LINUX_HOME_DIR
1013 UDir_UserLocal Backup to $EMERGENCY_LINUX_HOME_DIR/common/UserLocal Link UDir_UserLocalExt Backup to $EXTERNAL_EMERGENCY_LINUX_HOME_DIR/common/UserLocal
1014 Also {
1015 RunIfChanges_UDir_UserLocal, RunIfChanges_UDir_UserLocalExt Links to RunIfChanges_Bkp_UserLocal
1016 RunIfChanges_UDir_System, RunIfChanges_UDir_SystemExt Links to RunIfChanges_Bkp_System
1017 RunIfChanges_UDir_Root Link RunIfChanges_UDir_RootExt
1018 RunIfChanges_UDir_UsersStore Link RunIfChanges_UDir_UsersStoreExt
1019 RunIfChanges_UDir_Multimedia Link RunIfChanges_UDir_MultimediaExt
1020 RunIfChanges_UDir_Store Link RunIfChanges_UDir_StoreExt
1021 RunIfChanges_UDir_Text, RunIfChanges_UDir_TextExt Links to RunIfChanges_Bkp_Text
1022 }
1023}
1024
1025Running of scripts by CommonCron {
1026 Hourly
1027 MainLinux
1028 Bkp_Home
1029 RunIfChanges_Bkp_UserLocal
1030 RunIfChanges_Bkp_Text # Runs ClassifyCommonText and then Bkp_Text. Use before UDir_Text/RunIfChanges_UDir_Text!
1031 EmergencyLinux
1032 UDir_DiffBackups
1033 UDir_CriticalData
1034 RunIfChanges_UDir_Multimedia
1035 RunIfChanges_UDir_Text
1036 UDir_Home
1037 RunIfChanges_UDir_UserLocal
1038 Daily
1039 MainLinux
1040 RunIfChanges_Bkp_System
1041 EmergencyLinux
1042 RunIfChanges_UDir_Root
1043 RunIfChanges_UDir_System # UDir_System includes /root & /root/SystemLinks. I.E. Same as also running UDir_RootExt
1044 RunIfChanges_UDir_Store
1045 UDir_Data
1046 RunIfChanges_UDir_UsersStore # amule temp files take too long to backup to do this hourly
1047 External EmergencyLinux
1048 Always
1049 UDir_HomeExt
1050 UDir_DataExt
1051 UDir_CriticalDataExt
1052 UDir_DiffBackupsExt
1053 Tuesdays
1054 UDir_SystemExt # Includes /root & /root/SystemLinks. I.E. Same as also running UDir_RootExt
1055 UDir_UsersStoreExt # Before Multimedia: May free disk space
1056 UDir_MultimediaExt
1057 UDir_TextExt
1058 UDir_StoreExt
1059 UDir_UserLocalExt
1060 Not Tuesdays
1061 RunIfChanges_UDir_SystemExt # UDir_SystemExt includes /root & /root/SystemLinks. I.E. Same as also running UDir_RootExt
1062 RunIfChanges_UDir_RootExt
1063 RunIfChanges_UDir_UsersStoreExt # Before Multimedia: May free disk space
1064 RunIfChanges_UDir_MultimediaExt
1065 RunIfChanges_UDir_TextExt
1066 RunIfChanges_UDir_StoreExt
1067 RunIfChanges_UDir_UserLocalExt
1068 Weekly
1069 MainLinux
1070 Bkp_UserLocal
1071 Bkp_Text
1072 Bkp_System
1073 TestBackups_Common
1074 EmergencyLinux
1075 UDir_Text
1076 UDir_Store
1077 UDir_Multimedia
1078 UDir_UsersStore
1079 UDir_UserLocal
1080 Monthly
1081 EmergencyLinux
1082 UDir_System # Includes /root & /root/SystemLinks. I.E. Same as also running UDir_RootExt
1083}
1084
1085**************************************************************************************
1086Environment variable LANG.
1087**********************
1088 LANG variable can be set at the gnome login screen (Recommended: same as in last session).
1089 LANG=en_IE.utf8 English Ireland (English with Euro currency).
1090 Currently LANG has different values depending on how you log in:
1091 gdm: As selected in login screen
1092 Display manager stores session conditions (including selected language) in '$HOME/.dmrc'.
1093 Have created a .dmrc file in $COMMON_DIR
1094 mdm: As selected in login screen
1095 Display manager only stores Session=cinnamon in '$HOME/.dmrc'. Doesn't store language chosen in graphical login screen. Language stored in '$HOME/.dmrc' when /etc/default/locale is set (see below)
1096 Have created a .dmrc file in $COMMON_DIR
1097 tty: value in /etc/default/locale (set as system wide with Mint configuration)
1098 Have made /etc/default/locale a SystemLink in case Mint configuration has not been used.
1099 -Notes on gettext, locale:
1100 -Example of gettext used in a shell script. {
1101 #!/bin/bash
1102
1103 #Source gettext.sh to make its functions available:
1104 #eval_gettext (), eval_ngettext (), etc.
1105 . gettext.sh
1106
1107 #Base name of *.po file (in TEXTDOMAINDIR directories) where translated strings are.
1108 TEXTDOMAIN=amule
1109 export TEXTDOMAIN
1110
1111 #Directory where *.po files can be found. Most files are in 'language'
1112 #subdirectory (i.e.: es), some more in 'language_COUNTRY' (i.e.: es_ES).
1113 #If variable is not set, default directory (/usr/share/locale) is used.
1114 TEXTDOMAINDIR=/usr/share/locale-langpack
1115 export TEXTDOMAINDIR
1116
1117 #English Ireland.
1118 #LANGUAGE="en_IE:en"
1119 #LANG="en_IE.UTF-8"
1120
1121 #Spanish Spain.
1122 LANGUAGE="es_ES:es"
1123 LANG="es_ES.UTF-8"
1124
1125 export LANGUAGE
1126 export LANG
1127
1128 #Writes string translated to current language, if available.
1129 #Writes given string otherwise.
1130 gettext -s "Display credits for the document viewer creators"
1131 }
1132
1133**************************************************************************************
1134New user skeletons in $COMMON_MISC_DIR/AddUser_Skeleton.
1135**********************
1136
1137Updating/adding subdirectories/files to an Skeleton type:
1138 -Create a new user with UserType (Panel/UserSystem/Configuration/Add_a_new_user).
1139 -Log in as the new user, edit/modify configurations, trim special subdirectories (see below) and test all.
1140 -Make sure there are no 'System mail' messages: Skeleton will inherit them!
1141 -To add extra subdirectories/files to Skeleton type: copy from new user $HOME to skeleton type.
1142 -Run UpdateSkeletonType
1143
1144Special subdirectories:
1145 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.netbeans
1146 Remove: $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.netbeans/5.0/config/Services
1147 'Services' contains Original user's Project paths in non-text format (Not affected by 'ReplaceTextInAllFiles')
1148 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.aMule
1149 Remove: $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.aMule/Temp
1150 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.BitTornado
1151 Remove:
1152 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.BitTornado/datacache
1153 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.BitTornado/piececache
1154 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.BitTornado/torrentcache
1155 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.mozilla
1156 Remove:
1157 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.mozilla/firefox/XX.default/Cache
1158 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.mozilla/firefox/XX.default/Cache.Trash
1159 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.opera
1160 Remove:
1161 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.opera/cache4
1162 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/.opera/cacheOp
1163 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/documents/InternetMail/Account/.mozilla-thunderbird
1164 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/documents/InternetNews/Account/.mozilla-thunderbird
1165 $COMMON_MISC_DIR/AddUser_Skeleton/UserType/documents/LocalMail/.mozilla-thunderbird
1166 Run application and empty mail trays, trash, etc
1167
1168**************************************************************************************
1169Ati/Fglrx graphics driver
1170**********************
1171
1172Notes:
1173 -If configured with fglrxconfig: Afterwards copy font directories to xorg.conf from
1174 xorg.conf_backup (/etc/X11/xorg.conf.AtiDriver.Org)
1175 -Modules and configuration file handled by SystemLinks (read $COMMON_ETC_DIR/CommonSettings)
1176
1177**************************************************************************************
1178CUPS (Common Unix Printing System).
1179**********************
1180
1181gnome-cups-manager
1182 Make sure printer is switched on and reboot computer before
1183 creating a new printer with gnome-cups-manager.
1184
1185Printer currently has not colour ink cartridge:
1186-Used gnome-cups-manager (Properties/Advanced) to (temporarily) set Printout_Mode to Grayscale.
1187-Please note that for OpenOffice it is necessary to fix Printout_Mode for each document:
1188 File/Printer_Settings/Properties/Device: Modify Printout_Mode to High_Quality_Grayscale and save document.
1189 Note: Tools/Options/Print/Convert_colors_to_grayscale does not work.
1190
1191-Change (gnome-cups-manager) Printout_Mode back to 'Normal' if you install a colour ink cartridge.
1192-Change OpenOffice Printout_Mode to 'Normal' in those documents you want to print with colour if
1193 you install a colour ink cartridge.
1194
1195-Removing printer jobs (cups)
1196 When using 'DefaultPrinterJobsManager' never cancel jobs, delete them!
1197 'lprm' or 'cancel' do not seem to work.
1198
1199**************************************************************************************
1200MODIFIED DISTRIBUTION FILES. CHECK AFTER MAJOR SYSTEM UPDATE.
1201
1202**********************
1203
1204Read Docs/UbuntuLinux.zip/UbuntuLog.txt:
1205 DISTRIBUTION FILES MODIFIED.
1206 AFTER INSTALLATION LINUX CHANGES.
1207 DISTRIBUTION PACKAGES.
1208 OTHER PACKAGES.
1209 REMOVED PACKAGES.
1210
1211**************************************************************************************
1212LOCAL SHELLS AND RESOURCES
1213**********************
1214$COMMON_DIR
1215
1216Dir with resources available to all users. Directories and files are 'read only' except to root.
1217 $COMMON_BIN_DIR Shells
1218 $COMMON_SBIN_DIR Shells
1219 $COMMON_VAR_DIR CommonCron & BkpIfChanges_* temporary files, ZipCriticalFiles zips, etc.
1220 $COMMON_VAR_DIR/CommonCron CommonCron last run files. See CommonCron below.
1221 $COMMON_DIR/SystemDocs Local documentation.
1222 $COMMON_DIR/CommonCronTasks CommonCron system tasks files. See CommonCron below.
1223 $COMMON_DIR/CommonOpenOffice Common OpenOffice library and spread-sheet functions.
1224 $COMMON_DOSEMU_HOME_DIR Link to Dos emulation user home directory. Available to all users.
1225 $COMMON_STORE_DIR Backups, Multimedia files, etc.
1226 $COMMON_ETC_DIR CommonSystemShutdown/CommonSystemStartUp, DiskErrorsWarning, etc.
1227 $COMMON_MISC_DIR DosEmu, Icons, JavaProjects, OldLaunchers, etc.
1228The following directories are only writable by specific users:
1229 $COMMON_STORE_DIR/UsersStore/User Directories linked to $HOME/Store. Storage area for bulky files.
1230The following directories are, however, writable by all users:
1231 $COMMON_TEMP_DIR Directory to store files which can be swapped among users.
1232 $COMMON_TMP_DIR Directory for temporary files.
1233 $COMMON_DIR/.cddb Cds database. Linked to all users $HOME directory.
1234 Execute (search) only allowed to root. Files set to 744 and owner root
1235 by SystemCron_Hourly.
1236Notes:
1237 $COMMON_BIN_DIR shells:
1238 'ExtractZipRun': Provisionally modified: If Command is 'DefaultBrowser' or 'firefox', temporary files
1239 are not removed until process 'firefox-bin' is not running.
1240 'CheckXSessionErrors' : File $HOME/.xsession-errors grows in size very fast because of session errors.
1241 CheckXSessionErrors script file warns user of sudden size increases. If after a system update there are
1242 not so many errors it will be necessary to tune CheckXSessionErrors for a correct sensitivity:
1243 MaxIncreasePerSecond=40 #bytes
1244 'JarsToBin': Creates links to Java *.jar files in a given $PATH directory, through a JarWrapperScript, which
1245 allows running them as if they were executables.
1246
1247 $COMMON_SBIN_DIR shells:
1248 'BkpIfChanges_Bkp_System' & 'RunIfChanges_UDir_System': After a mayor upgrade check that 'dpkg' still uses DpkgInfoDir=/var/lib/dpkg/info.
1249
1250**********************
1251$USRLOCAL_DIR Contains links, $USRLOCAL_DIR/PackageName, to /usr/local/PackageNameVersionXX.
1252
1253**********************
1254$PACKAGES_DIR Packages Directory to store non distribution packages.
1255
1256**********************
1257$COMMON_ETC_DIR/CommonSettings File with settings to personalize 'Common services'.
1258 Run $COMMON_SBIN_DIR/SystemLinks after editing above file to update
1259 'Alternatives' files (See $SYSTEMLINKS_DIR below).
1260$COMMON_ETC_DIR/CommonTextKeys Directory with files and subdirectories specifying possible categories of Books
1261 stored in $COMMON_TEXT_DIR (See $COMMON_SBIN_DIR/ClassifyCommonText).
1262**********************
1263$SYSTEMLINKS_DIR Links scheme to configure distribution (according to hardware) and adapt it
1264 to allow services in $COMMON_DIR. Self contained in one directory, to change
1265 $COMMON_DIR services (CommonCron tasks, backups, etc) just replace
1266 $SYSTEMLINKS_DIR.
1267Subdirectories:
1268 $SYSTEMLINKS/ToLink Shells and files with information (i.e. SystemDirectory=/sbin) that allows
1269 'SystemLinks' (shell script) to link them to corresponding directories.
1270 !! Important:
1271 To control the order in which links are made, it is possible to add a number to
1272 this directory's file names.
1273 Example: 003_FileName
1274 The number means that the file will be linked after file 002_OtherName and before
1275 any other file without numbers leading their name. If 003_FileName links a file in
1276 $SYSTEMLINKS/Store that file should be named 'FileName' (Without leading numbers)
1277 $SYSTEMLINKS/Store Directories and files to be linked according to $SYSTEMLINKS/ToLink
1278 $SYSTEMLINKS/DriveSpecific Directory specific to a disk drive. Contains:
1279 file fstab: fstab for this particular drive.
1280 dir CommonCronTasks: Tasks for this drive.
1281 file This_is.EmergencyLinux | This_is.ExtEmergencyLinux | This_is.MainLinux: Role this drive plays.
1282Notes:
1283 -$SYSTEMLINKS/DriveSpecific is a link and its contents change (and therefore the drive's role) by the source dir it points to.
1284 -$SYSTEMLINKS/ToLink directory must have 755 permissions for the links to work!
1285 After a major system update check that files to link are not already installed in different directories. Use: synaptic.
1286 -$SYSTEMLINKS/Store/Alternatives Alternative files/directories to be linked to $SYSTEMLINKS/Store.
1287 -SytemLinks. Where link sources should be:
1288 ToLink:
1289 Files not in distribution (except those that do not allow SystemLinks info lines).
1290 Store:
1291 Replacements for distribution files/directories.
1292 Comments (I.E: modifications) in ToLink file.
1293 Links between system files/directories (SystemLinks as switchboard).
1294 Directories not in distribution.
1295 Non text files or those where SystemLinks info lines are not allowed.
1296
1297**************************************************************************************
1298man, manpath.
1299 -'manpath' produces a list of directories to include in 'man database'. In the list are included all existing
1300 PATH_DIR/../man or PATH_DIR/../share/man directories where PATH_DIR stands for all directories included in $PATH.
1301 -Current (logged as root) 'manpath' output:
1302 /usr/local/man:/usr/local/share/man:/usr/share/man:/usr/local/_/Java/man:/usr/X11R6/man:/usr/man
1303
1304**************************************************************************************
1305CRON
1306 How it works:
1307 -/etc/crontab and crontabs /etc/cron.d/* /var/spool/cron/crontabs/* are checked periodically
1308 by the cron daemon which runs the specified shell scripts at the specified times:
1309 # /etc/crontab: system-wide crontab
1310 # Unlike any other crontab you don't have to run the `crontab'
1311 # command to install the new version when you edit this file.
1312 # This file also has a username field, that none of the other crontabs do.
1313
1314 SHELL=/bin/sh
1315 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
1316
1317 # m h dom mon dow user command
1318 17 * * * * root run-parts --report /etc/cron.hourly
1319 25 6 * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily
1320 47 6 * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly
1321 52 6 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly
1322 #
1323 The first five elements of the last lines have the following meaning when read from left to right: minutes,
1324 hours, day of the month, month of the year, day of the week (0 is Sunday). * disregards that value. The command
1325 following runs (by root) at the time specification.
1326
1327 -The above shell scripts will not be run if the system is not running at the specified time unless 'anacron'
1328 is installed. 'anacron' uses /etc/cron.d/anacron crontab:
1329 {
1330 # /etc/cron.d/anacron: crontab entries for the anacron package
1331 SHELL=/bin/sh
1332 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
1333 30 7 * * * root test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null
1334 }
1335
1336 -run-parts and/or anacron look into directories /etc/cron.{hourly,daily,weekly,monthly} for scripts to be run.
1337 The info about anacron last run is stored in (the date stamp of) /var/spool/anacron files (Note: deleting these
1338 files does not mean that scripts will be run next time crontab is checked by cron).
1339
1340 -cron/anacron sends mail to the owner of the crontab (or to the user specified in MAILTO variable in crontab)
1341 if any shell script in /etc/cron.{hourly,daily,weekly,monthly} fails or produces output.
1342
1343 -To create a normal user crontab (in /var/spool/cron/crontabs) (Deprecated. See CommonCron below.):
1344 -login as user
1345 -run crontab -e
1346 -edit file/new-file using vi commands:
1347 i insert
1348 Esc : exit text mode
1349 w write to file
1350 q quit
1351 Note: you can copy and paste!
1352 -exit vi: the file will be saved as /var/spool/cron/crontabs/UserName
1353 -Typical crontab file:
1354 {
1355 # DO NOT EDIT THIS FILE - edit the master and reinstall.
1356 # (/tmp/crontab.6EEt4S/crontab installed on Sat Jan 22 22:42:36 2005)
1357 # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
1358 MAILTO="root"
1359 4-59/5 * * * * test -x /sbin/CronShell && /sbin/CronShell
1360 }
1361 -The first five elements of each line have the following meaning when read from left to right: minutes,
1362 hours, day of the month, month of the year, day of the week (0 is Sunday). * disregards that value. The
1363 command following runs (by user) at the time specification. '-*/10' means every 10 minutes starting with
1364 60, 10, 20..60. See below for an extract of man crontab(5).
1365
1366 -My User cron scheme:
1367 -'CommonCron' runs tasks every 5 minutes:
1368 -'CommonCron' skips tasks if following files exist:
1369 $STARTINGUP (SystemLinks /etc/profile.d/profile.local.sh) Skip tasks while system is starting up.
1370 $SHUTTINGDOWN (SystemLinks /etc/profile.d/profile.local.sh) Skip tasks while system is shutting down.
1371 -'CommonCron' tasks skip backups if following file exist:
1372 $DISK_ERROR_WARNING (SystemLinks /etc/profile.d/profile.local.sh) To avoid backing up corrupted data.
1373 -'CommonCron' tasks run (As the corresponding user -'su'- to ensure system security) subshells for common, as root
1374 with HOME=/home/common (to run system tasks) and for every logged user (user 'root' also, with root's $HOME, if
1375 logged in). Different priorities (nice) are assigned to system tasks and to users tasks. Some tasks,
1376 (CheckTemperatures) have their own priority. Current backup program, dar, seems to adjust its own
1377 nice number (NiceNumber:NiceRun: -2:-2, 11:6, 19:14).
1378 -'CommonCron' sets environment variables to the values they would have in a normal shell of the corresponding user
1379 (except for PS1,PS2 and variables with terminal info, which are unset, and $HOME/.profile which is not sourced.
1380 Read 'ENVIRONMENT CONFIGURATION', below). It also checks which tasks (CycleNames: frequently, hourly, daily, weekly,
1381 monthly, yearly) should be carried out taking in account timestamps in 'Last CommonCron run' files found in
1382 directory $COMMON_VAR_DIR/CommonCron and Tasks still running as indicated by 'Lock files', with format
1383 'CommonCron.`basename $HOME`.CycleName', in /tmp directory ($HOME is /home/common for common system tasks).
1384 For each task 'CommonCron' launches (In background) subshell 'CommonCron' with parameter 'CycleName'.
1385 -'CommonCron' reads and runs lines from the corresponding 'Task.CycleName' file in $HOME/CommonCronTasks directory.
1386 For each 'Line run' 'stdout' and 'stderror' are redirected to a temporary file.
1387 In case of interactive commands (There should not be any!) 'stdin' is supplied by the file 'Task.CycleName'
1388 (Commands following an interactive Command will be 'swallowed' by it an not run) and carriage returns will be
1389 supplied continuously when all lines of the 'Task.CycleName' file are read. 'CommonCron' adds to the temporary
1390 file a 'History' of all command runs and their exit codes. In case of error (non 0 exit code of any of the lines
1391 run) a mail will be sent, to the corresponding user ('root' for common system tasks), including the temporary file.
1392 -'CommonCron' assignment of tasks (Each line: 'TaskName:DoTaskConditions'. DoTaskConditions:
1393 'NowDate': current date array; 'FileDate': 'last run' file date array):
1394 'frequently:true' #Runs always.
1395 'hourly:[ ${NowDate[Hour]} -ne ${FileDate[Hour]} ] || [ ${NowDate[Day]} -ne ${FileDate[Day]} ]' #Different hour/day.
1396 'daily:[ ${NowDate[Day]} -ne ${FileDate[Day]} ] || [ ${NowDate[Year]} -ne ${FileDate[Year]} ]' #Day 1..366.
1397 'weekly:[ ${NowDate[Week]} -ne ${FileDate[Week]} ] || [ ${NowDate[Year]} -ne ${FileDate[Year]} ]'#Week 1..53.
1398 'monthly:[ ${NowDate[Month]} -ne ${FileDate[Month]} ] || [ ${NowDate[Year]} -ne ${FileDate[Year]} ]'#Diff month/year.
1399 'yearly:[ ${NowDate[Year]} -ne ${FileDate[Year]} ]' #Different year.
1400
1401 -Please note:
1402 -'CommonCron' logs to $COMMON_VAR_DIR/CommonLog.
1403 -'CommonCron's block 'Cycles' will execute very fast leaving behind instances of 'CommonCron task' running
1404 (in background) the selected tasks. This way Cycles with long execution times will not hinder other cycles
1405 (Both of the same and other users).
1406 -A Cycle will not run if the last instance of the same cycle (and same user) is still running.
1407 -Tasks will not run at fixed times (I.E. an 'hourly' task will run as soon as the System boots and will not wait until
1408 o'clock time).
1409
1410 -$HOME/CommonCronTasks files:
1411 -Lines starting with '#' will be ignored.
1412 -Comments can be included after commands. I.E.: 'SoundBackup -auto #-auto for non interactive mode!'
1413 -Interactive commands are not allowed. They can block commands in following lines and, in some cases,
1414 can overload the uP (If the command asks for an specific input and stdin supplies carriage returns
1415 continuously).
1416 -If execution of commands, in all lines, exceeds the cycle period, next cycle run will be delayed.
1417 -Variables declared in CommonCron can be used in the lines. New variables can also be declared.
1418 Very simple processing can be done in the lines, in particular using variable 'ExitCode' which
1419 contains exit code of commands in previous line. Example:
1420 #Task file: CommonCron.weekly: One command per line.
1421 #
1422 MountUmountSharedFs $$ -mount $EMERGENCY_LINUX_STORE_DIR
1423 if [ $ExitCode -eq 0 ];then Mounted=true;else Mounted=false;fi
1424 if $Mounted;then Bkp_Images -auto;fi
1425 if $Mounted;then Bkp_Store -auto;fi
1426 if $Mounted;then Bkp_Packages -auto;fi
1427 if $Mounted;then Bkp_Audio -auto;fi
1428 if $Mounted;then Bkp_Video -auto;fi
1429 if $Mounted;then Bkp_UsrLocal -auto;fi
1430 MountUmountSharedFs $$ -umount $EMERGENCY_LINUX_STORE_DIR
1431 ZipCriticalFiles
1432 find $HOME \\( -name \\*~ -or -name \\.\\*~ \\) -exec rm -f {} \\;
1433
1434**************************************************************************************
1435BOOT
1436****************************
1437GRUB
1438 Partition numbers in GRUB are zero based.
1439 hd0,1 corresponds to /dev/sda2
1440 hd0,3 corresponds to /dev/sda4
1441 Important!: hd0 is the drive configured in BIOS to boot:
1442
1443****************************
1444BOOT SEQUENCE AND MODULE LOADING.
1445Kernel is decompressed and loaded.
1446Kernel uses (somehow) System map file: /boot/System.map-KernelVersion
1447Image filesystem created and temporarily mounted
1448 File: /boot/initrd.img-KernelVersion
1449 To check contents:
1450 modprobe loop
1451 losetup /dev/loop0 /boot/initrd.img-KernelVersion
1452 mount /dev/loop0 /mnt
1453 Note: Use Nautilus to navigate /mnt
1454 Modules necessary for starp up included in Image filesystem:
1455 Default modules included if /etc/mkinitrd/modules empty.
1456 Modules loaded according to /etc/mkinitrd/modules list order (The one on top first).
1457 For contents of /etc/mkinitrd/modules to take effect you must run:
1458 mkinitrd -o /boot/initrd.img-KernelVersion
1459 Use : mkinitrd -o /boot/initrd.img-KernelVersion -r /dev/sda (or -r /dev/hda)
1460 to change root drive.
1461More modules loaded as specified in /etc/modules loaded in list order (The one on top first).
1462Available modules to include in /etc/modules: Check directory /lib/modules/Kernel_Version.
1463 Note: -Old distribution: Sequence of loading is important: hdparm does not work (i.e.: setting dma mode)
1464 if some drive module is loaded after ide-*. I have found:
1465 'fglrx' if loaded first, disk access and XWindows performance seem to improve.
1466 'ide_cd' must load after 'ide_generic'
1467 'piix' must load before 'ide_disk'
1468 -New distribution Ubuntu 5.10: Sequence of loading is important: Graphics run faster if
1469 fglrx module is loaded last. Current (Novenber 2006) /etc/modules:
1470 #SystemLinks: added:
1471 # msdos To enable mounting of msdos filesystems (I.E.: floppy)
1472 # fglrx Ati radeon graphics card driver. Ubuntu 5.10: If last in list graphics faster.
1473 lp
1474 mousedev
1475 psmouse
1476 sbp2
1477 sr_mod
1478 msdos
1479 fglrx
1480
1481More modules loaded by hotplug program.
1482Etc.
1483
1484Important!: lsmod lists modules in the order they were loaded but in the opposite way as in
1485 /etc/mkinitrd/modules and /etc/modules: The one on top last!
1486
1487**************************************************************************************
1488MAKING A BOOT FLOPPY TO BOOT HARD DISK PARTITION.
1489
1490#################
1491!! Check grub-floppy. Probably does what follows. Note current version does not work: missing library.
1492#################
1493
1494Information from article 'Booting from the network with GRUB' in SUSE support database.
1495
1496{
1497manolo@linux:~> fdformat /dev/fd0
1498
1499manolo@linux:~> su
1500Password:
1501
1502linux:/home/manolo # mke2fs -m 0 /dev/fd0
1503mke2fs 1.28 (31-Aug-2002)
1504Filesystem label=
1505OS type: Linux
1506Block size=1024 (log=0)
1507Fragment size=1024 (log=0)
1508184 inodes, 1440 blocks
15090 blocks (0.00%) reserved for the super user
1510First data block=1
15111 block group
15128192 blocks per group, 8192 fragments per group
1513184 inodes per group
1514
1515Writing inode tables: done
1516Writing superblocks and filesystem accounting information: done
1517
1518This filesystem will be automatically checked every 35 mounts or
1519180 days, whichever comes first. Use tune2fs -c or -i to override.
1520
1521
1522linux:/home/manolo # mount /media/floppy
1523
1524linux:/home/manolo # cd /boot/grub
1525
1526linux:/boot/grub # cp * /media/floppy
1527
1528linux:/media/floppy # cd /home/manolo
1529
1530linux:/home/manolo # umount /media/floppy
1531
1532linux:/home/manolo # grub
1533
1534grub> install (fd0)/stage1 (fd0) (fd0)/stage2 p (fd0)/menu.lst
1535
1536grub> quit
1537
1538linux:/home/manolo # exit
1539
1540manolo@linux:~>
1541}
1542
1543Now edit menu.lst in floppy to select the hard disk partition you want to boot from
1544(Hard disk partition should contain kernel, etc. Please read next section on how to copy file
1545systems between partitions)
1546
1547See menu.lst example in BOOT/GRUB section above.
1548
1549****************************************************************************************************
1550COPYING DIRECTORIES RECURSIVELY WITHOUT LOSING OWNER, USER PERMISSIONS AND LINK INFORMATION
1551
1552Use rsync. Can be simplified by using UDir_*
1553
1554**************************************************************************************
1555-ENVIRONMENT CONFIGURATION:
1556
1557****************************
1558UBUNTU DISTRIBUTION.
1559
1560 -Order of execution of files affecting environment:
1561 -Tty login:
1562 -login daemon reads login defaults from /etc/login.defs and then runs /etc/profile.
1563
1564 -Gnome login:
1565 -After 'gdmgreeter' gets user info, gdm runs, as root the following (according to
1566 PostLoginScriptDir,PreSessionScriptDir,BaseXsession,PostSessionScriptDir values
1567 in gdm.conf -SystemLinks) scripts:
1568 -/etc/gdm/PostLogin/Default (If it exists. Currently there is a Default.sample)
1569 -Conditions at shell start -root was logged in (Jun 30 14:54) before running gdm login-
1570 (whoami,who,env | sort inserted at beginning of /etc/gdm/PostLogin/Default):
1571 whoami
1572 root
1573 who
1574 root :0 Jun 30 14:54
1575 env | sort
1576 CONSOLE=/dev/console
1577 DISPLAY=:20
1578 HOME=/home/manolo
1579 INIT_VERSION=sysvinit-2.85
1580 LOGNAME=manolo
1581 PATH=/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games
1582 PREVLEVEL=N
1583 PWD=/home/manolo
1584 RUNLEVEL=2
1585 RUNNING_UNDER_GDM=true
1586 SHELL=/bin/bash
1587 SHLVL=3
1588 TERM=linux
1589 USER=manolo
1590 USERNAME=manolo
1591 XAUTHORITY=/var/lib/gdm/:20.Xauth
1592 X_SERVERS=/var/lib/gdm/:20.Xservers
1593 _=/usr/bin/env
1594 previous=N
1595 runlevel=2
1596 Note: output not redirected to $HOME/x-session-errors.
1597 -/etc/gdm/PreSession/Default
1598 -gdm creates: $HOME/.xsession-errors and creates/touches: $HOME/.Xauthority $HOME/.ICEauthority
1599 -Conditions at shell start -root was logged in (Jun 30 14:54) before running gdm login-
1600 (whoami,who,env | sort inserted at beginning of /etc/gdm/PreSession/Default):
1601 whoami
1602 root
1603 who
1604 root :0 Jun 30 14:54
1605 env | sort
1606 CONSOLE=/dev/console
1607 DESKTOP_SESSION=default
1608 DISPLAY=:20
1609 GDMSESSION=default
1610 HOME=/home/manolo
1611 INIT_VERSION=sysvinit-2.85
1612 LOGNAME=manolo
1613 PATH=/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games
1614 PREVLEVEL=N
1615 PWD=/home/manolo
1616 RUNLEVEL=2
1617 RUNNING_UNDER_GDM=true
1618 SHELL=/bin/bash
1619 SHLVL=3
1620 TERM=linux
1621 USER=manolo
1622 USERNAME=manolo
1623 XAUTHORITY=/var/lib/gdm/:20.Xauth
1624 X_SERVERS=/var/lib/gdm/:20.Xservers
1625 _=/usr/bin/env
1626 previous=N
1627 runlevel=2
1628 Note: output redirected to $HOME/x-session-errors.
1629 -Calls sessreg to register logged in user in the system. 'sessreg' uses ppid to register.
1630 Parent process of /etc/gdm/PreSession/Default later exec's /etc/gdm/Xsession which
1631 (see below) sources scripts which, finally, exec x-session-manager. Therefore x-session-manager
1632 has the same pid registered by sessreg.
1633 -Echoes message for debugging purposes.
1634 -/etc/gdm/Xsession args
1635 -Conditions at shell start -root was logged in (Jun 30 14:54) before running gdm login-
1636 (whoami,who,env | sort inserted at beginning of /etc/gdm/Xsession):
1637 whoami
1638 manolo
1639 who
1640 root :0 Jun 30 14:54
1641 manolo :20 Jun 30 15:24
1642 env | sort
1643 DESKTOP_SESSION=default
1644 DISPLAY=:20
1645 GDMSESSION=default
1646 HOME=/home/manolo
1647 LANG=en_US
1648 LANGUAGE=en_ES:en_GB:en_US:en
1649 LOGNAME=manolo
1650 PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/games
1651 PWD=/home/manolo
1652 SHELL=/bin/bash
1653 SHLVL=1
1654 USER=manolo
1655 USERNAME=manolo
1656 _=/usr/bin/env
1657 XAUTHORITY=/home/manolo/.Xauthority
1658 Note: output redirected to $HOME/x-session-errors.
1659 -args: 'failsafe | custom'. Xsession changes to NewArgs: 'custom' -> default, 'failsafe | ""' -> failsafe.
1660 -/etc/gdm/Xsession sources shells in /etc/X11/Xsession.d in the order specified by the digits in each script
1661 name (55numlockx sets gdm startup NumLock). Scripts in this directory not including '_' or '-' in their
1662 name will be ignored. The last script exec's (depending on configuration in gdm.conf):
1663 '/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager NewArgs'
1664 -I guess gdm checks Xsession exit code, which may depend on LogOut mode (shutdown, reboot, ..), and runs
1665 corresponding programs (according to values in gdm.conf) after /etc/gdm/PostSession/Default.
1666 -/etc/gdm/PostSession/Default
1667 -Conditions at shell start -root was logged in (Jun 30 14:54) before running gdm login-
1668 (whoami,who,env | sort inserted at beginning of /etc/gdm/PostSession/Default):
1669 whoami
1670 root
1671 who
1672 root :0 Jun 30 14:54
1673 manolo :20 Jun 30 15:12
1674 env | sort
1675 CONSOLE=/dev/console
1676 DISPLAY=:20
1677 HOME=/home/manolo
1678 INIT_VERSION=sysvinit-2.85
1679 LOGNAME=manolo
1680 PATH=/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games
1681 PREVLEVEL=N
1682 PWD=/home/manolo
1683 RUNLEVEL=2
1684 RUNNING_UNDER_GDM=true
1685 SHELL=/bin/bash
1686 SHLVL=3
1687 TERM=linux
1688 USER=manolo
1689 USERNAME=manolo
1690 XAUTHORITY=/var/lib/gdm/:20.Xauth
1691 X_SERVERS=/var/lib/gdm/:20.Xservers
1692 _=/usr/bin/env
1693 previous=N
1694 runlevel=2
1695 Note: output not redirected to $HOME/x-session-errors.
1696 -Calls sessreg to unregister user in the system. ppid is ppid of /etc/gdm/Xsession
1697
1698 -'su' shell PATH is set according to /etc/login.defs ENV_SUPATH (root) & ENV_PATH (user).
1699
1700 -Shells run by cron:
1701 -Default environment:
1702 SHELL=/bin/sh
1703 PATH=/usr/bin:/bin
1704 _=/usr/bin/env
1705 PWD=/root
1706 LANG=en_US
1707 HOME=/root
1708 SHLVL=2
1709 LANGUAGE=en_ES:en_GB:en_US:en
1710 LOGNAME=root
1711 -Variables that can be set in crontab invoking shell: SHELL,MAILTO,PATH
1712
1713****************************
1714MODIFIED UBUNTU DISTRIBUTION (SystemLinks).
1715
1716 -Order of execution of files affecting environment:
1717 -Tty login:
1718 -login daemon reads login defaults from /etc/login.defs (SystemLinks) then runs /etc/profile (SystemLinks)
1719 which:
1720 -sources /etc/profile.local (SystemLinks) which:
1721 -sources $HOME/.profile.
1722
1723 -Gnome login:
1724 -After 'gdmgreeter' gets user info, gdm runs, as root the following (according to
1725 PostLoginScriptDir,PreSessionScriptDir,BaseXsession,PostSessionScriptDir values
1726 in gdm.conf -SystemLinks) scripts:
1727 -/etc/gdm/LocalGdm/PostLogin/Default #SystemLinks
1728 -Conditions as for /etc/gdm/PostLogin/Default in UBUNTU DISTRIBUTION above.
1729 -Local processing allowing mounting of encrypted $HOME, etc.
1730 -Sources /etc/gdm/PostLogin/Default (If it exists). #Distribution file.
1731 -/etc/gdm/PreSession/Default. #Distribution file.
1732 -gdm creates: $HOME/.xsession-errors and creates/touches: $HOME/.Xauthority $HOME/.ICEauthority
1733 -Conditions at shell start as in UBUNTU DISTRIBUTION above.
1734 -/etc/gdm/Xsession args
1735 -Conditions at shell start as in UBUNTU DISTRIBUTION above.
1736 -args: 'failsafe | custom'. Xsession changes to NewArgs: 'custom' -> default, 'failsafe | ""' -> failsafe.
1737 -/etc/gdm/Xsession sources shells in /etc/X11/Xsession.d in the order specified by the digits in each script
1738 name (55numlockx sets gdm startup NumLock). Scripts in this directory not including '_' or '-' in their
1739 name will be ignored.
1740 First script 00profile_local (SystemLinks a link to /etc/profile) which sources /etc/profile.local which,
1741 in turn, sources $HOME/.profile. /etc/profile.local sets user environment for gdm session.
1742 Last script exec's (depending on configuration in gdm.conf):
1743 '/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager NewArgs'
1744 -I guess gdm checks Xsession exit code, which may depend on LogOut mode (shutdown, reboot, ..), and runs
1745 corresponding programs (according to values in gdm.conf) after /etc/gdm/PostSession/Default.
1746 -/etc/gdm/LocalGdm/PostSession/Default #SystemLinks
1747 -Conditions as for /etc/gdm/PostSession/Default in UBUNTU DISTRIBUTION above.
1748 -Local processing allowing unmounting of encrypted $HOME, etc.
1749 -Sources /etc/gdm/PostSession/Default #Distribution file.
1750 Notes:-If $HOME is an encrypted fs and LogOut specifies shutdown or reboot, UserCrypt cannot kill a,
1751 new, gconfd-2 process (Even if owner of gconf-2 is not root!), which has file
1752 '$HOME/.gconfd/saved_state' open, and UserCrypt fails. Output of UserCrypt:
1753 Crypt:Stopping loop: Killing processes using 'fuser -kvm /dev/loop0':
1754 USER PID ACCESS COMMAND
1755 /dev/loop0 manolo2 13538 f.... gconfd-2
1756 ioctl: LOOP_CLR_FD: Device or resource busy
1757 Crypt:Stopping loop:'/dev/loop0' (/home/common/Store/Data/manolo2.crypt) could not be stopped. Aborting.
1758 -Problem remains even if 'rm -R $HOME/.gconfd' is run before calling UserCrypt ('lsof -p gconfd-2Pid'
1759 reports '$HOME/.gconfd/saved_state (deleted)').
1760 -Solved (most of the times :-(. There may be other daemons using mounted loop: fam, evolution, ..)
1761 running 'su $USER -c "gconftool-2 --shutdown"' in /etc/gdm/LocalGdm/PostSession/Default before
1762 running 'UserCrypt $USER'.
1763
1764 -'su' shell PATH is set according to /etc/login.defs (Link from SystemLinks) ENV_SUPATH (root) & ENV_PATH (user).
1765
1766 -$COMMON_BIN_DIR/gksu runs as root after running /etc/profile (Link from SystemLinks) for a correct environment.
1767
1768 -Shells run by CommonCron source /etc/profile (Link from SystemLinks) which, after sourcing
1769 /etc/profile.local, sets PATH and other environment variables.
1770
1771**************************************************************************************
1772COMMANDS.
1773****************************
1774Compare files
1775 cmp all kinds of files
1776 diff text files.
1777****************************
1778
1779**************************************************************************************
1780USB.
1781****************************
1782Flash memory
1783 -Flash memory is treated as a SCSI hard disk.
1784 -A HOTPLUG daemon checks USB ports and assigns the (first?) flash memory as
1785 /dev/sdX regardless of which USB port the memory is plugged in.
1786 (X: next available Scsi name. I.E.: sdc if there are already a SerialATA Hd -sda- and another Flash memory -sdb-).
1787 -Entry in /etc/fstab (sdb: Current first Usb scsi; SerialATA Hd: sda):
1788 /dev/sdb /media/UsbScsi auto noauto,users,exec 0 0
1789 -To use the memory as a mounted file system mount:
1790 /dev/sdb on /media/UsbScsi #Currently first Usb Scsi
1791 or
1792 /dev/sdx on /media/UsbScsiX #Create /media/UsbScsiX first.
1793 -Read in Internet:
1794 Linux recognizes UFD, JetFlash, or JetFlashA as a SCSI device; therefore, you
1795 should see it listed as "/dev/sda", "sdb", etc.
1796 -Notes:
1797 Ubuntu 5.1 does not show an icon in Desktop when UsbScsi devices are mounted.
1798!! Ubuntu 5.1 automount does not work well and if flash memory is plugged in at boot time,
1799!! keyboard and mouse are blocked. Plug flash memory in after boot. Unplug before halt.
1800
1801****************************
1802**************************************************************************************
1803FLOPPY
1804 There seems to be a limit to the number of files a floppy can contain (Although df reports
1805 plenty of space available, There is a 'No space left on device' error if you try to copy more files to
1806 the floppy). The ext2 filesystem also seems to use a lot of space which somehow is not reported by df.
1807
1808****************************
1809Process Info
1810 -Files opened/used by a process: lsof -p Pid #See man lsof
1811 -System calls of a process:strace -p Pid #strace intercepts and records the system calls which are called
1812 by a process and the signals which are received by a process.
1813
1814**************************************************************************************
1815MEMORY USAGE.
1816**********************
1817To see memory used by a process use 'pmap':
1818 pmap -d ProcessPid
1819
1820To see used memory use 'vmstat':
1821 vmstat
1822 vmstat -a Active/inactive memory info.
1823 vmstat -s Memory and CPU usage info.
1824
1825To see total memory usage, use 'free'.
1826 use 'free -m' to see memory size in Mb.
1827
1828To see memory used by all running processes, use 'top'.
1829 Useful interactive commands:
1830 Shift_M : Order by memory usage
1831 m : Show memory information
1832 W : Save current conditions so that next time top is invoked it starts in the same way.
1833 h : Help.
1834 q : Quit.
1835
1836 Useful command line options:
1837 -b : Batch mode. Useful to redirect output to another program.
1838 -n <n>: Number of iterations.
1839
1840Example to print memory usage:
1841 -run top
1842 -m
1843 -Shift_M
1844 -W
1845 -q
1846 -run: top -b -n 1 | lp
1847
1848**************************************************************************************
1849nice versus priority.
1850**********************
1851See nice number and priority of a process with 'top' or 'top -p PID'
1852
1853Nice number (-20..19; -20:maximum_priority/minimum_niceness, 19:minimum_priority/maximum_niceness)
1854recomends a priority for a process to the kernel scheduler.
1855Actual priority depends of nice number (0 by default) and many other factors and has a range of
18560..139 (kernel 2.6) where 0 means highest priority.
1857
1858**************************************************************************************