Difference between revisions of "OS4X Core administrative scripts"

From OS4X
Jump to navigation Jump to search
Line 39: Line 39:
 
*(optional) additional MySQL dump parameters required for your installation
 
*(optional) additional MySQL dump parameters required for your installation
  
The second parameter offers you the possibility to pass parameters for the dump tool. One handy parameter is "--no-tablepaces" which supports you in dumping content from the database without having PROCESS permissions of the configured database user.
+
The second parameter offers you the possibility to pass parameters for the dump tool. One handy parameter is "--no-tablespaces" which supports you in dumping content from the database without having PROCESS permissions of the configured database user.
  
 
Examples:
 
Examples:
  /opt/os4x/scripts/os4x_arcvhive.sh 365
+
  /opt/os4x/scripts/os4x_archive.sh 365
  /opt/os4x/scripts/os4x_arcvhive.sh 365 "--no-tablespaces"
+
  /opt/os4x/scripts/os4x_archive.sh 365 "--no-tablespaces"
  
 
All entries older that this given age are archived. The archived entities are:
 
All entries older that this given age are archived. The archived entities are:

Revision as of 06:20, 24 April 2024

daxware2os4x

If you want to migrate from a Hüngsberg Daxware system to OS4X, you can easily use this script to mass-import all partner entries to OS4X. Just point the variable "PASSW_DAX" to the appropriate file. Example:

PASSW_DAX=/tmp/passw.dax 

The rest of the script works out-of-the-box if you have a configured OS4X system running.

swan2os4x.ksh

To mass-import partner entries from SWAN 1.5 database to OS4X, the company SSC GmbH created this script which is free to use. You should run this script from a shell where the environment variable "SWAN_HOME" is available. Also check the position of the OS4X program "os4xped", which is being called in line 68 (also check the echo command on line 67).

os4xbackup

This script works without parameters. It checks the configuration file and the backup directory (as given in the configuration panel). If all requirements are fulfilled, a SQL dump will be saved with a timestamp extension in the backup directory. The output of a sample run is:

hostname:/opt/os4x/scripts # ./os4xbackup 
backup file: /opt/os4x/backup/os4x.20050113.182639.sql 

So you can re-use the output for further post-processes.

os4xrestore

For restoring the OS4X database, make sure all OS4X processes are stopped. Also make sure the database is up and running. If you are not sure which file you want to restore, start the script without any parameter. It will say something like this:

hostname:/opt/os4x/scripts # ./os4xrestore 
no backup file as parameter 1 given. choose one of the existing: 
os4x.20041015.205850.sql 
os4x.20041222.175616.sql 
os4x.20050113.182639.sql 

These are the existing database dump files in the backup directory as configured in the configuration panel. If you are sure which file to restore, start the script with the filename as given above as the only parameter.

hostname:/opt/os4x/scripts # ./os4xrestore os4x.20050113.182639.sql 
backup file: /opt/os4x/backup/os4x.20050113.182639.sql restored 

Now you can safely start the OS4X processes again.


os4x_archive.sh

This script is intended to keep the MySQL database usage clean and usable.

Parameters of this scripts are:

  • (mandatory) maximum age of entries (in days) for the oldest entries available in the MySQL database
  • (optional) additional MySQL dump parameters required for your installation

The second parameter offers you the possibility to pass parameters for the dump tool. One handy parameter is "--no-tablespaces" which supports you in dumping content from the database without having PROCESS permissions of the configured database user.

Examples:

/opt/os4x/scripts/os4x_archive.sh 365
/opt/os4x/scripts/os4x_archive.sh 365 "--no-tablespaces"

All entries older that this given age are archived. The archived entities are:

  • all logs (incl. vault):
    • receive log
    • send log
    • system log
    • event (aka "script") log
    • archived xERPs
    • directory scanner
  • CRL vault
  • CSR vault

The script dynamically checks if OS4X Enteprise is enabled. If this is the case, the script also archives the following entities older than the given age:

  • all jobs
  • all XML entries of archived jobs
  • all plugin logs of archived jobs

The script dynamically verifies the running circumstances:

  • is the database of type "MySQL"
  • is a dump tool correctly configured
  • is a backup directory correctly configured
  • is the parameter valid

Since the scripts locks the database tables which will be used for archiving, please plan a downtime for OS4X. Also, please use the following procedure for using this script:

  1. Shutdown OS4X processes
  2. Shutdown webserver
  3. Run archive script
  4. Start webserver
  5. Start OS4X processes

The created archive is a valid MySQL dump which can be easily imported with standard MySQL tools (like the "mysqlclient" command line tool). The archive is saved in the configured database backup directory as a compressed MySQL dump file, with a filename

os4x_archive.$TIMESTAMP.sql.gz

where "$TIMESTAMP" is a string containing the date- and timestamp when the script was started. Example:

/opt/os4x/backup/os4x_archive.20130813.121123.sql.gz

You can easily restore its content via the script "os4xrestore" documented above.

Since 2024-02-27, the script needs write permissions to the directory "/tmp". Since then, it also checks every return code of the dumping process for each table. If it is not zero, the process exits without continueing its work.