$string = 'Abc def ghi';
if (strpos($string, 'def') !== false) {
     echo 'True';
} else {
     echo 'False';
}

Unifi Network Controller on Raspberry Pi Kategoria: Linux | Autor: Bartłomiej Gałęzia

sudo apt-get install haveged -y
sudo apt-get install openjdk-8-jre-headless -y
echo 'deb http://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ubnt.com/unifi/unifi-repo.gpg
sudo apt-get update && sudo apt-get install unifi -y
https://localhost:8443 

https://www.youtube.com/watch?v=VH8b6ocohHU

[New Server]

apt-get install python-ldap libldap2-dev
mkdir /root/samba3

[Old Server]

/etc/init.d/samba stop
rsync -aP /var/lib/samba/private/secrets.tdb root@[new_server]:/root/samba3/
rsync -aP /var/lib/samba/wins.dat root@[new_server]:/root/samba3/
rsync -aP /var/lib/samba/winbindd_idmap.tdb root@[new_server]:/root/samba3/
rsync -aP /etc/samba/smb.conf root@[new_server]:/root/samba3/

[New Server]

vim /root/samba3/smb.conf
netbios name = [new_server]

Uwaga!! "Workgroup" w nowym i starym pliku smb.conf musi być taka sama.

samba-tool domain samba3upgrade --dbdir=/root/samba3/ --realm='''MYDOMAIN.COM''' /root/samba3/smb.conf

Po migracji:

vim /etc/samba/smb.conf
dns forwarder = 8.8.8.8
#       idmap_ldb:use rfc2307 = yes
vim /etc/nsswitch.conf
passwd:         files winbind
group:          files winbind

https://samba.tranquil.it/doc/en/samba_advanced_methods/samba_migrate_from_samba3_to_samba-ad.html

Redmine - Agile plugin install Kategoria: Redmine | Autor: Bartłomiej Gałęzia

1. Pobierz plugin w paczce zip.

https://www.redmineup.com/pages/plugins/agile

2. Wrzuć ją na serwer redmine i rozpakuj:

cd /opt/redmine/plugins/
wget http://10.50.50.50/apps/redmine/redmine_agile-1_6_2-light.zip
unzip redmine_agile-1_6_2-light.zip

3. Zainstaluj

bundle install --without development test --no-deployment
bundle exec rake redmine:plugins NAME=redmine_agile RAILS_ENV=production

4. Restart aplikacji

touch /opt/redmine/tmp/restart.txt

https://www.redmineup.com/pages/help/agile/installing-redmine-agile-plugin-on-linux?utm_source=Main&utm_medium=email&utm_campaign=Download_plugin_email&utm_term=download_plugin_email&utm_content=installation_guide

RSYNC - Limit prędkości Kategoria: Linux | Autor: Bartłomiej Gałęzia

rsync --bwlimit=1000 /path/to/source /path/to/dest/

https://www.cyberciti.biz/faq/how-to-set-keep-rsync-from-using-all-your-bandwidth-on-linux-unix/

Debian 10 - nslookup command not found Kategoria: Linux | Autor: Bartłomiej Gałęzia

aptitude install dnsutils

Problem

E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'

Rozwiązanie

apt-get --allow-releaseinfo-change update

OCS Reports - Install agent on Linux Kategoria: Linux | Tagi: OCS | Autor: Bartłomiej Gałęzia

aptitude install make libmodule-install-perl dmidecode libxml-simple-perl libcompress-zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap libnet-netmask-perl
wget http://path.to.ocsagent/Ocsinventory-Unix-Agent-2.8.1.tar.gz
tar -xvzf Ocsinventory-Unix-Agent-2.8.1.tar.gz
cd Ocsinventory-Unix-Agent-2.8.1
perl Makefile.PL
make
make install
Where do you want to write the configuration file? /etc/ocsinventory
Specify log file path you want to use?  /var/log/ocs_agent.log
Do you want disable SSL CA verification configuration option (not recommended) ? [y]
Do you want to set CA certificate chain file path ? [n]

https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers/

OCS Reports - Install on Debian 10 Kategoria: Linux | Tagi: debian, debian10, OCS | Autor: Bartłomiej Gałęzia

1. Packages

apt-get update
apt-get install aptitude sudo vim mc nmap screen make cmake gcc make apache2 libapache2-mod-perl2 libapache-dbi-perl libapache-db-perl libapache2-mod-php mariadb-server mariadb-client software-properties-common php7.3 libapache2-mod-php7.3 php7.3-common php7.3-sqlite3 php7.3-mysql php7.3-gmp php7.3-curl php7.3-mbstring php7.3-gd php7.3-cli php7.3-xml php7.3-zip php7.3-soap php7.3-json php-pclzip git curl perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl libapache-dbi-perl libapache2-mod-perl2 libapache2-mod-perl2-dev

2. Mysql

sudo mysql_secure_installation
sudo mysql -u root -p

Zobacz całość

Dell PowerEdge R210 II - Debian 10 network card drivers Kategoria: Linux | Autor: Bartłomiej Gałęzia

http://ftp.br.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_20190114-2_all.deb

mkdir /mnt/usb
mount /dev/sdb /mnt/usb
cp /mnt/usb/firmware-bnx2_20190114-2_all.deb /root/
cd /root
PATH=/usr/bin
dpkg -i firmware-bnx2_20190114-2_all.deb
vim /etc/apt/sources.list
deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

https://debian.pkgs.org/10/debian-nonfree-arm64/firmware-bnx2_20190114-2_all.deb.html

Ubuntu 16.04 Live CD - Install MC Kategoria: Linux | Autor: Bartłomiej Gałęzia

sudo vim /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu xenial main universe
sudp apt-get update
sudp apt-get install mc

Źródło: https://linuxporady.pl/ubuntu-16-04-live-cd-i-instalacja-mc-midnight-commander/

$("#element_id").trigger("change"); //tak działa przy każdej zmianie, również przy autoładowaniu danych
$("#element_id").trigger("change.select2"); //tak działa tylko po kliknięciu na pozycję w menu

 

https://select2.org/programmatic-control/add-select-clear-items

https://select2.org/programmatic-control/events

Codeigniter - Put content in log file Kategoria: Codeigniter | Autor: Bartłomiej Gałęzia

log_message('error', 'Some variable did not contain a value.');

Źródło: https://codeigniter.com/userguide3/general/errors.html

Redmine - Email error "wrong version number" Kategoria: Linux | Autor: Bartłomiej Gałęzia

Email delivery error: SSL_connect returned=1 errno=0 state=error: wrong version number
vim config/configuration.yml

comment line "tls: true"

...
email_delivery:
    delivery_method: :smtp
    smtp_settings:
    #tls: true
    enable_starttls_auto: true
...

Redmine - Migracja i upgrade z 1.4.4 do 4.2.2 Kategoria: Linux | Autor: Bartłomiej Gałęzia

Migracja: old.domena.pl -> new.domena.pl

1. Zrobić zrzut bazy z old.domena.pl

mysqldump -p --user=username database_name > zrzut_bazy.sql

2. Zainstalować aktualną wersję redmine na new.domena.pl

Zobacz całość

"The vast majority of solutions I've read for this say to change the disk controller to IDE (it already was IDE and the original HDD was IDE) or changing to type to PIIX4 or PIIX3 (neither of these appear to change the behaviour)."

Wchodzimy w ustawienia maszyny wirtualnej:

Storage -> Controller: IDE -> Type -> zmień z PIIX4 na PIIX3

Storage -> Controller: SATA -> dysk.vdi -> Remove

Storage -> Controller: IDE -> Add new storage -> disk.vdi

Ok

Start VM

Źródło: https://forums.virtualbox.org/viewtopic.php?f=6&t=83318

 

Jquery upload error Kategoria: PHP | Autor: Bartłomiej Gałęzia

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Rozwiązanie:

wgraj nową wersję pliku UploadHandler.php i skasuj wszystkie foldery upload użytkowników.

Wkhtmltopdf div background color Kategoria: PHP | Autor: Bartłomiej Gałęzia

Acronis - Add local user Kategoria: Linux | Tagi: acronis | Autor: Bartłomiej Gałęzia

Settings -> Account -> Add account -> Serach [username] -> Select the roles of the accounts [Administrator] -> Done

vim /etc/security/acronisagent.conf
[username]

Źródło: https://forum.acronis.com/forum/acronis-backup-125/linux-management-server-only-root-can-log

Debian 10 - SVN server Kategoria: Linux | Tagi: subversion, svn, viewvc | Autor: Bartłomiej Gałęzia

1. Install SVN packages

sudo apt-get install apache2 subversion libapache2-mod-svn libsvn-dev
sudo a2enmod dav
sudo a2enmod dav_svn

Zobacz całość

Wyszukaj

Zapisz się do newsletera