Mautic cronjob example

8,23,38,52 * * * * www-data php /var/www/html/bin/console mautic:segments:update > /var/log/cron.pipe 2>&1 –env=prod
*/5 * * * * www-data php /var/www/html/bin/console mautic:import > /var/log/cron.pipe 2>&1 –env=prod
5,20,35,50 * * * * www-data php /var/www/html/bin/console mautic:campaigns:rebuild > /var/log/cron.pipe 2>&1 –env=prod
2,17,32,47 * * * * www-data php /var/www/html/bin/console mautic:campaigns:trigger > /var/log/cron.pipe 2>&1 –env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:messages:send > /var/log/cron.pipe 2>&1 –env=prod
0 * * * * www-data php /var/www/html/bin/console mautic:emails:send > /var/log/cron.pipe 2>&1 –env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:email:fetch > /var/log/cron.pipe 2>&1 –env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:social:monitoring > /var/log/cron.pipe 2>&1 –env=prod
0,15,30,45 * * * * www-data php /var/www/html/bin/console mautic:webhooks:process > /var/log/cron.pipe 2>&1 –env=pord
0 * * * * www-data php /var/www/html/bin/console mautic:broadcasts:send > /var/log/cron.pipe 2>&1 –env=prod
* 1 * * * www-data php /var/www/html/bin/console mautic:maintenance:cleanup –days-old=365 > /var/log/cron.pipe 2>&1 –env=prod
0 4 15 * * www-data php /var/www/html/bin/console mautic:iplookup:download > /var/log/cron.pipe 2>&1 –env=prod
*/5 * * * * www-data php /var/www/html/bin/console mautic:reports:scheduler > /var/log/cron.pipe 2>&1 –env=prod
0 5 10 * * www-data php /var/www/html/bin/console mautic:unusedip:delete > /var/log/cron.pipe 2>&1 –env=prod

How to Install Mautic on CentOS 7

From: https://hostpresto.com/community/tutorials/how-to-install-mautic-on-centos-7/

In addition, I modified some commands according to my actual situation. I install mautic with 4.4.5 version.

Mautic is a free and open source marketing automation software. It is written in PHP using the Symfony framework and uses MySQL/MariaDB to store its data. It provides many out of the box tools for marketing automation such as Social Media Marketing which allows you to engage the leads through social media. It also provides Contact management and email marketing tools. It allows you to create valuable forms for campaigns to collect information and generate reports using the data gathered.

In this tutorial, we will learn to install Mautic on CentOS 7.

Requirements

Mautic can be installed on systems with a small amount of RAM. You will also need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.

Installing Mautic

Before installing any package it is recommended that you update the packages and repository using the following command.

yum -y update

Once you have your system updated, run the following command to install few packages on your server.

Install Mariadb 10.4, view this manual. https://mariadb.org/download/?t=repo-config&d=CentOS+7+%28x86_64%29&v=10.4&r_m=xtom_hk
yum -y install httpd mariadb-server mariadb

The above command will install Apache web server with MariaDB database server. Now you will need to install PHP. Mautic supports both PHP 5.6 and 7.0. In this tutorial, we will learn to install both PHP 5.6 and 7.0. You must install only one version of PHP. The YUM repository contains PHP version 5.4 only, hence we will need to use the Webtatic repository to install a version of PHP 5.6 or 7.0. Run the following commands for installing EPEL repository as EPEL repository is required before we install Webtatic repository.

I install php 7.4

yum -y install epel-releaseyum -y update
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
## Install PHP 7.4 
yum --enablerepo=remi-php74 install php

Now install Webtatic repository using the following commands.

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

To install PHP 5.6 and all the required PHP modules, run the following command.yum -y install php56w php56w-cli php56w-xml php56w-pdo php56w-mcrypt php56w-imap php56w-posix php56w-intl php56w-mysqli php56w-pear php56w-imap php56w-curl php56w-gd

To install PHP 7.4 and all the required PHP modules, run the following command.

yum -y install php-cli php-xml php-pdo php-mcrypt php-imap php-posix php-intl php-mysqli php-pear php-imap php-curl php-gd

Make sure that you are using only one of the PHP versions mentioned above. Once you have PHP installed, you can check the version of PHP using the following command.

php -v

You should get following output.

[root@liptan-pc ~]# php -v
PHP 7.4.33 (cli) (built: Oct 31 2022 10:36:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Once PHP is installed, you will need to configure few thing in php.ini configuration. Open /etc/php.ini using your favorite editor.

vi /etc/php.ini

scroll down to find the following lines.

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 512M

You can increase the memory_limit to a higher amount so that the processing of PHP can also be done faster. Next find the following line,

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = 

Change the timezone according to your country. Save the file and exit from the editor.

Now install Composer using the following command. Composer is a dependency manager for PHP.

curl -sS https://getcomposer.org/installer 
mv composer.phar /usr/bin/composer
php /usr/bin/composer

To start the Apache web server and enable it to start at boot time, run the following commands.

systemctl start httpd
systemctl enable httpd

Start MariaDB and enable it to start at boot time using the following commands.

systemctl start mariadb
systemctl enable mariadb

Now run the following command to secure your MariaDB installation.

mysql_secure_installation

It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y and set a strong password for the installation. It will further ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes or y to all the questions.

To create a database we will need to login to MySQL command line first. Run the following command for same.

mysql -u root -p

This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your Mautic installation.

CREATE DATABASE mautic;

The above query will create a database named mautic. For the database, you can use any name you prefer at the place of mautic. Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. To create a new database user, run the following query.

CREATE USER 'mautic_user'@'localhost' IDENTIFIED BY 'StrongPassword';

The above query will create a user with username mautic_user. You can use any preferred username instead of mautic_user. Replace StrongPassword with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.

GRANT ALL PRIVILEGES ON mautic.* TO 'mautic_user'@'localhost';

Now run the following command to immediately apply the changes on the database privileges.

FLUSH PRIVILEGES;

Exit from MySQL prompt using exit command.

As we have all the dependencies ready, you can install Mautic using composer. Run the following command for same.

cd /var/www/
wget https://www.mautic.org/download/latest -O mautic.zip
wget https://github.com/mautic/mautic/releases/download/4.4.5/4.4.5-update.zip

The above command will download the latest version of the application archive in mautic.zip file. Now unzip the file into /var/www/mautic directory using the following command.

unzip mautic.zip -d mautic

If you don’t have unzip installed, you can run yum -y install unzip. Now create a virtual host for your domain or subdomain which will be used to access the Mautic site. Run the following command for same.nano /etc/httpd/conf.d/yourdomain.com.conf Copy and paste the following lines into the file.

<VirtualHost *:80>
    ServerAdmin me@liptanbiswas.com
    ServerName yourdomain.com
    DocumentRoot /var/www/mautic
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory><All /var/www/mautic>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>TransferLog /var/log/httpd/your domain.com_access.log ErrorLog /var/log/httpd/yourdomain.com_error.log </VirtualHost>

In the above configuration, replace yourdomain.com with your domain or subdomain.

Provide the ownership of the files to the Apache web server using the following command.chown -R apache:apache /var/www/mautic

Now restart the Apache web server using the following command.

systemctl restart httpd

Now access the following URL through your web browser.http://yourdomain.com

You will see following web interface of environment check. If you have followed the tutorial correctly, you should see that you have all the requirement satisfied to install Mautic.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1112193432.png” alt=”” />

Click on Next Step button to proceed further. In this interface, you will need to provide the database credentials. Choose MySQL PDO as database driver. Don’t change the value of database host and port. Provide the name of the database with database username and password. Choose No for backup existing tables.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/726148226.png” alt=”” />

Click on Next Step button to proceed further. If the database credentials are correct, the installer will write the tables into the database. In next step of installation, you will need to create an administrative account.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1203427402.png” alt=”” />

Provide the administrator details and click Next Step to proceed further. In the last step, you will need to configure the email.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1714184244.png” alt=”” />

Choose the name and email who will send the outgoing emails. For email handling, you can choose to send immediately. Now choose the mailer transport application. You can choose PHP Mail, if you don’t have an SMTP server. The emails will be sent using phpmail() function. Which is not recommended as the emails will likely go to spam folder. If you have SMTP server, you can provide the server details. You can also choose the many third party email agent for sending emails.

Once done, click on Next Step button to proceed further. The installation of Mautic is now finished, you can click on Proceed to Mautic to go to Mautic Dashboard after logging in.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/923864607.png” alt=”” />

Conclusion

In this tutorial, we have learned how to install Mautic Marketing Automation Software on CentOS 7. You can now deploy the application on your server to manage the marketing of your organization.

Collection 1

Collect AIGC Keywords. Otherwise AIGCText.com domain name for sale.

A Chinese Golden Buddhist temple encircled by a white divine snake, mountains flood, clouds, plants, by VictoNgai, light effects

AIGC需要准备什么

AIGC全称AI-GeneratedContent,即ai产生内容,是今年忽然火爆起来,但它绝不是概念,而是实实在在存在于应用领域,之所以火,主要是红杉的发言和技术跟进,呈现到广野中。

引用一些文章:

任何新技术的核心价值都是场景下的创新应用,AIGC也不例外。场景是技术应用的一个环境,也是检验技术能力的一个外部条件。越好的技术,越具有场景运用的普适性。因此,场景是检验AIGC的发展现状及未来的一个重要因素。

就目前来说,广义上的AIGC应用场景大致可以分为To B和To C两个赛道。在B端的的应用主要是通过“AI+”,来为各产业进行赋能,在C端主要是通过与人交互,进行内容生产,主要有包括AI驾驶、AI助手、AI辅助文本生成等。

在寻求机遇时,不妨先储备品牌域名。域名是稀缺性资源,只会越来越少。

一个好的域名,可以增强企业或品牌在市场上的差异化竞争,以及不同程度上加大获取用户流量的能力,以便于项目能够获得到很好的运营。

对于AIGC,可以关注以下域名:

AIGC.art

AIGCLabs. com

AIGCMedia.com

AIGCStyle.com

AIGCSpeed.com

AIGCText.com

AIGCPro.com

AIGCPros.com

AIGCStudio.com

NFTsAIGC.com

WebAIGC.com

AIGCStack.com

AIGCBrand.com

Invalid library (maybe not a PHP library)

Add simplexml to php.

When I input command ‘php -m’, output ‘Invalid library (maybe not a PHP library)’.

Afer I re-make ext/simplexml, probem still appear.

A few minutes, I find php/modules contain simplexml.so, however make install create other path.

I re-make again:

pipize –clean

pipize

./configure –with-php-config=/usr/local/php/bin/php-config

make

make install

php -m, that is ok

PHP Warning: Module ‘modulename’ already loaded in Unknown on line 0

问题

当在命令行运行PHP的CLI版本时,您可能会收到类似以下错误:

[root@myserver /root]$ php -v PHP Warning: Module 'pcre' already loaded in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/spl.so' - /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/spl.so: Undefined symbol "pcre_exec" in Unknown on line 0 PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0 PHP Warning: Module 'session' already loaded in Unknown on line 0 PHP Warning: Module 'exif' already loaded in Unknown on line 0 PHP 5.2.3 (cli) (built: Jun 14 2007 15:29:17) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

原因

在PHP中对于大多数扩展而言加载有两种方法。一种是直接编译扩展到PHP二进制文件。另一种是通过一个ini文件动态加载的共享扩展。这些错误表明,动态扩展正在通过.ini文件加载,即使它们已经被编译到PHP二进制文件中。

修复

要解决此问题,您必须编辑你的php.ini(或extensions.ini文件)文件并注释掉那些已经编译的扩展。例如,修改完成后,你的ini文件修改完可能看起来像下面这几行:

;extension=pcre.so
;extension=spl.so
;extension=simplexml.so
;extension=session.so
;extension=exif.so

当然你也可以删除这些行,而不是注释掉。一但你注释或删除掉这些行,再运行php -v 警告消失。

附加信息

要了解哪些扩展已经编译到你的PHP中,运行以下命令:

php -m

您还可以查看configure命令,它会显示通过编译、建成共享或动态模块启动的扩展。

php -i | grep Configure

动态扩展通常位于一个特殊的“extensions”的文件夹中,其会根据操作系统环境而变化。你的php.ini通常有一行会显示这个说明文件夹。例如:

Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/"

原文连接http://www.somacon.com/p520.php

Linux下后台运行几种方法

From: https://blog.csdn.net/u013253075/article/details/121979156

1、nohup
将程序以忽略挂起信号的方式运行起来

补充说明
nohup命令 可以将程序以忽略挂起信号的方式运行起来,被运行的程序的输出信息将不会显示到终端。
无论是否将 nohup 命令的输出重定向到终端,输出都将附加到当前目录的 nohup.out 文件中。
如果当前目录的 nohup.out 文件不可写,输出重定向到$HOME/nohup.out文件中。
如果没有文件能创建或打开以用于追加,那么 command 参数指定的命令不可调用。
如果标准错误是一个终端,那么把指定的命令写给标准错误的所有输出作为标准输出重定向到相同的文件描述符。

简单实例:
nohup command &

指定输出实例
nohup command > myout.file 2>&1 &

其他相关命令,比较常用
ctrl + z #可以将一个正在前台执行的命令放到后台,并且处于暂停状态。
fg #将后台任务切换到前台执行
bg #将一个在后台暂停的命令,变成在后台继续执行。如果后台中有多个命令,可以用bg %jobnumber将选中的命令调出
jobs #查看后台运行的状态,jobs -l选项可显示所有任务的PID
ps -ef | grep command 或者 ps aux | grep command #查看进程
kill -9 进程id #杀掉对应的进程,
更高级的用法如下:
ps aux | grep command | grep -v grep | awk ‘{print $1}’ | xargs kill -9 #这个表示直接通过command获取进程id并直接kill掉

2、screen
用于命令行终端切换

a、会话恢复
只要Screen本身没有终止,在其内部运行的会话都可以恢复。这一点对于远程登录的用户特别有用——即使网络连接中断,
用户也不会失去对已经打开的命令行会话的控制。只要再次登录到主机上执行screen -r就可以恢复会话的运行。
同样在暂时离开的时候,也可以执行分离命令detach,在保证里面的程序正常运行的情况下让Screen挂起(切换到后台)

b、多窗口
在Screen环境下,所有的会话都独立的运行,并拥有各自的编号、输入、输出和窗口缓存。用户可以通过快捷键在不同的窗口下切换,
并可以自由的重定向各个窗口的输入和输出。Screen实现了基本的文本操作,如复制粘贴等;还提供了类似滚动条的功能,
可以查看窗口状况的历史记录。窗口还可以被分区和命名,还可以监视后台窗口的活动。 会话共享 Screen可以让一个或多个用户
从不同终端多次登录一个会话,并共享会话的所有特性(比如可以看到完全相同的输出)。它同时提供了窗口访问权限的机制,
可以对窗口进行密码保护。

c、screen的安装
yum install -y screen

基本语法
screen -AmRvx -[ls -wipe][-d <作业名称>][-h <行数>][-r <作业名称>][-s ][-S <作业名称>]

选项
-A  将所有的视窗都调整为目前终端机的大小。
-d <作业名称>  将指定的screen作业离线。
-h <行数>  指定视窗的缓冲区行数。
-m  即使目前已在作业中的screen作业,仍强制建立新的screen作业。
-r <作业名称>  恢复离线的screen作业。
-R  先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。
-s  指定建立新视窗时,所要执行的shell。
-S <作业名称>  指定screen作业的名称。
-v  显示版本信息。
-x  恢复之前离线的screen作业。
-ls或–list  显示目前所有的screen作业。
-wipe  检查目前所有的screen作业,并删除已经无法使用的screen作业。

常用screen参数
screen -S yourname -> 新建一个叫yourname的session
screen -ls -> 列出当前所有的session
screen -r yourname -> 回到yourname这个session
screen -d yourname -> 远程detach某个session
screen -d -r yourname -> 结束当前session并回到yourname这个session

在每个screen session 下,所有命令都以 ctrl+a(Ctrl + a) 开始。

Ctrl + a ? -> 显示所有键绑定信息
Ctrl + a c -> 创建一个新的运行shell的窗口并切换到该窗口
Ctrl + a n -> Next,切换到下一个 window
Ctrl + a p -> Previous,切换到前一个 window
Ctrl + a 0..9 -> 切换到第 0..9 个 window
Ctrl+a [Space] -> 由视窗0循序切换到视窗9
Ctrl + a Ctrl + a -> 在两个最近使用的 window 间切换
Ctrl + a x -> 锁住当前的 window,需用用户密码解锁
Ctrl + a d -> detach,暂时离开当前session,将目前的 screen session (可能含有多个 windows) 丢到后台执行,并会回到还没进 screen 时的状态,此时在 screen session 里,每个 window 内运行的 process (无论是前台/后台)都在继续执行,即使 logout 也不影响。
Ctrl + a z -> 把当前session放到后台执行,用 shell 的 fg 命令则可回去。
Ctrl + a w -> 显示所有窗口列表
Ctrl + a t -> time,显示当前时间,和系统的 load
Ctrl + a k -> kill window,强行关闭当前的 window
Ctrl + a -> 进入 copy mode,在 copy mode 下可以回滚、搜索、复制就像用使用 [vi 一样
C-b Backward,PageUp
C-f Forward,PageDown
H(大写) High,将光标移至左上角
L Low,将光标移至左下角
0 移到行首
$ 行末
w forward one word,以字为单位往前移
b backward one word,以字为单位往后移
Space 第一次按为标记区起点,第二次按为终点
Esc 结束 copy mode
Ctrl + a ] -> paste,把刚刚在 copy mode 选定的内容贴上

操作示例见:https://wangchujiang.com/linux-command/c/screen.html

3、daemonize工具

安装

git clone git://github.com/bmc/daemonize.git
sh configure && make && sudo make install

-a #挂载到输出文件,而不是冲掉默认值。只有应用了-e and/or -o 被指定的情况。
-e #重定向输出标准错误到指定的文件中,替代/dev/null
-o #重定向输出标准到指定的文件中,替代/dev/null
-E name=value #增加环境变量给给后台程序。这个这个参数类型一定要是name=value格式。参数可以设置多次。
-c directory #定制运行命令前的目录。
-p pidfile #定制自己的pid存放位置。
-l lockfile #单实例启动时将会检查这个文件。
-u user #定制程序以谁的身份运行的。

Install httpd

ref:https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM

ref:https://dev.to/xsavitar/issue-starting-up-apache-after-upgrading-to-php-8-on-macos-2274

ref:https://blog.csdn.net/qq_44009311/article/details/105496897

ref:https://blog.csdn.net/weixin_33736649/article/details/88198840

system: centos 8

php: php 8.0.22

配置httpd

sudo vi /etc/httpd/conf/httpd.ini

添加

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

开机启动

systemctl enable httpd

启动httpd

systemctl start httpd

查看日志

/var/log/httpd/error_log

/var/log/httpd/access_log

转发到php上,php版本市8.0.22,使用php-fpm,所以httpd.conf中不需要配置AddType php之类的,可以注释掉。

关注httpd.conf底部IncludeOptional conf.d/*.conf,在httpd的conf.d(/etc/httpd/conf.d/)新建

vi /etc/httpd/conf.d/httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName vrntf.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
<Directory "/var/www/html">
    Options none
    AllowOverride none
    Require all granted
</Directory>

ErrorLog "/var/log/httpd/wp-error.log"
CustomLog "/var/log/httpd/wp-access.log" combined
</VirtualHost>

注意本实例中DocumentRoot是配置为和httpd的一致,根据需要进行调整,在安装php时设置的user,要保证php有权限访问得到。

fcgi后面的路径也必须能访问得到。