Changes

From Amahi Wiki
Jump to: navigation, search
no edit summary
Updated: 07 Jul 2021
=== Database Restore ===
* Install Script:
=== Database Update to UTF8 ===
<pre style="white-space: pre-wrap; word-break: keep-all;">echo "alter database appdb charset=utf8" | mysql -u$HDA_DB_USERNAME -p$HDA_DB_PASSWORD</pre>
=== Large Database Load ===
or
<pre style="white-space: pre-wrap; word-break: keep-all;">mysql --max_allowed_packet=128M -u$HDA_DB_USERNAME -p$HDA_DB_PASSWORD $HDA_DB_DBNAME < app.sql;</pre>
=== Backup App Config on Uninstall ===
find . -name .htaccess -exec mv {} {}.tmp \;
=== Add Server (Service) Feature Functions ===
* Check if service is active:
systemctl is-active service
echo Restarting appname service;
systemctl restart appname.service;
* Restart Service if 'active'
if [ `systemctl is-active appname.service` == "active" ]; then
echo Restarting appname.service...
systemctl restart appname.service
echo Done!
fi
* Change service run level, start, and stop priority:
:Edit the service, i.e. ''/etc/init.d/adito'' and change the parameters (Run level: 0-6, start priority: 1-99, and stop priority: 1-99).
php_value mbstring.func_overload 6</pre>
</blockquote>
* Displays PHP Modules Installed
php -m
* Apache mod_rewrite to allow use of .htaccess for Fedora 19/21/23/25/27 (replace similar lines above ''</Directory>''):
Options Indexes FollowSymLinks MultiViews
</blockquote></pre>
* Reference to wiki:
<pre style="white-space: pre-wrap; word-break: keep-all;"><nowiki><b>NOTE:</b> Refer to the <a href="https://wiki.amahi.org/index.php/appname" target="_">appname</a> Amahi wiki page for help in changing the default configuration settings.</nowiki></pre>
===Scripted Functions===
[ -d /var/log ] && echo "Directory exist" || echo "Directory does not exist"
* Compare files:
<nowikipre style="white-space: pre-wrap; word-break: keep-all;">[[ /etc/resolv.conf -ef /etc/resolv.conf ]]</nowiki> && echo "Same files" || echo "Different Files" <nowiki>[[ /etc/resolv.conf -ef /etc/passwd ]]</nowiki> && echo "Same files" || echo "Different Files"</pre>
* Source file unarchives into ''unpack'' folder:
# Check for unpack folder
fi
* Create/Preserve Share
if [ -d /var/hda/files/share sharename/ ]; then echo sharename share exists...files preserved!
else
echo share directory created mkdir -p /var/HDAhda/files/sharesharename chown-R $HDA_1ST_ADMIN:users /var/hda/files/sharesharename chmod-R 755 775 /var/hda/files/sharename echo sharename sharecreated...permissions set!
fi
* Remove Share
if [ -d /var/hda/files/share ]; then echo sharename share directory exists...files preserved! echo echo To remove sharethem, you need to in terminal run: echo ‘sudo rm -ref rf /var/HDAhda/files/share’ fisharename’
* Network Interface Name:
HDA_DEVICE=`nmcli d | grep 'ethernet' | awk '{print $1;}'`;
HDA_DEVICE=`ip route | awk '/^default/ { printf $5 }'`;
or
<pre style="white-space: pre-wrap; word-break: keep-all;">HDA_DEVICE=`ip addr show |grep -w inet |egrep -v '(127.0.0.1|tun|secondary)' |awk '{ print $7}'`</pre>
* Fully Qualified Domain Name:
HSTNM=`hostname -f`
HDADOM=`cat /etc/resolv.conf | grep 'search' | awk '{ print $2 }'`;
:or
<pre style="white-space: pre-wrap; word-break: keep-all;">HDADOM=$(echo "SELECT value FROM settings WHERE name='domain'" | mysql hda_production -uamahihda -pAmahiHDARulez -s)</pre>
* HDA IP Address
<pre style="white-space: pre-wrap; word-break: keep-all;">HDAIP=$(/sbin/ip -o -4 addr list $HDA_DEVICE | awk '{print $4}' | cut -d/ -f1);</pre>
* HDA Broadcast IP
<pre style="white-space: pre-wrap; word-break: keep-all;">HDA_BIP=`ip addr show |grep -w inet |egrep -v '(127.0.0.1|tun)' |awk '{ print $4}'`</pre>
* HDA MAC Address
HDA_MAC=`ip addr show | grep -w ether | awk '{ print $2 }'`
* HDA Netmask
<pre style="white-space: pre-wrap; word-break: keep-all;">HDA_NET=`ip addr show |grep -w inet |egrep -v '(127.0.0.1|tun)' |awk '{ print $2}'| cut -d "/" -f 2`</pre>
* HDA Subnet
<pre style="white-space: pre-wrap; word-break: keep-all;">HDA_SUB=`netstat -r |egrep -v '(Kernel|Destination|default|10|docker0)' |awk '{ print $1}'`</pre>
* First Admin User:
FUSER=`/var/hda/platform/html/script/first-admin`
:or
<pre style="white-space: pre-wrap; word-break: keep-all;">FUSER=$(echo "SELECT login FROM users WHERE admin=1 ORDER BY id ASC LIMIT 1" | mysql hda_production -uamahihda -pAmahiHDARulez -s)</pre>
* Check OS Version:
<pre style="white-space: pre-wrap; word-break: keep-all;">FVER=`cat /etc/fedora-release | awk -F'release ' '{print $2}' | sed 's/(Laughlin)//'`;</pre>
if [ $FVER == '14' ]; then
...
fi
:or
<pre style="white-space: pre-wrap; word-break: keep-all;"> FVER=`cat /etc/fedora-release | awk -F'release ' '{print $2}' | sed 's/(Verne)//'`;
if [ $FVER == '16' ]; then
...
fi</pre>
* Install Fedora (RPM) package
if [ -f /etc/fedora-release ]; then
<a href="<nowiki>http://www.google.com</nowiki>" target="_">Google</a>
* Redirect to specific URL (change ''url='' to desired path (i.e. <nowiki>http://appname/appdirectory</nowiki>):
<prestyle="white-space: pre-wrap; word-break: keep-all;">echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</HTML>' > html/index.html
chown apache:users html/index.html</pre>
* Redirect to specific PHP file (change ''app.php'' to desired file):<pre>cat > html/index.php << 'EOF'<?php include("app.php") ?>EOF</pre>* Amahi Advanced User Warning:<pre <nowikistyle="white-space: pre-wrap; word-break: keep-all;"><p><markstyle="border:3px; border-style:solid; border-color:#FF0000; padding: 1em;"><b>WARNING:</b> This application is designed for advanced users and should be used with caution. Use could disrupt and alter your server functionality. This application is a Fedora supported application and not endorsed or officially supported by Amahi.</mark></p></nowikipre>
* Wiki collapsible code
:Select ''Item Collapse''
</div><br \>
</pre>
* Restrict <nowiki><pre></nowiki> Width
<nowiki><pre style="white-space: pre-wrap; word-break: keep-all;">text</pre></nowiki>
===Miscellaneous===
* Extract files to path...preserving unchanged or newer files
tar -xzpf file -C path --keep-newer-files
* Retrieve System Information
apaste --sysinfo
# Run ExecStartPre with root-permissions
PermissionsStartOnly=true
ExecStartPre=-/usr/bin/mkdir -p /var/run/dhis
ExecStartPre=/usr/bin/chown -R nobody:nobody /var/run/dhis/
# Run ExecStart with User=nobody / Group=nobody
12,424

edits