我试图在重启Debian 7.9之后配置Redmine的自动启动,但是,我不能这样做。通常我会用两个命令启动Redmine:
为了自动启动,我创建了LSBInitScript(/etc/init.d/redmine)。 https://wiki.debian.org/LSBInitScripts
脚本的完整内容:
#!/bin/bash
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redmine webrick
# Description: redmine webrick server autostart-script
### END INIT INFO
. /lib/lsb/init-functions
# Modify it to your configuration
DIR=/opt/redmine/current
# Start Redmine in daemon mode.
start(){
log_daemon_msg "Starting Redmine WebRick"
cd $DIR
log_progress_msg
ruby script/rails server webrick -e production -d > redmine-start.log 2>&1
log_progress_msg
log_end_msg 0
}
# Stop Redmine daemon
stop(){
log_daemon_msg "Stopping Redmine WebRick"
RUBYPID=`ps aux | grep "ruby script/rails server webrick -e production -d" | grep -v grep | awk '{print $2}'`
log_progress_msg
if [ "x$RUBYPID" != "x" ]; then
kill -2 $RUBYPID
fi
log_end_msg 0
}
# Check if Redmine is running
status(){
RUBYPID=`ps aux | grep "ruby script/rails server webrick -e production -d" | grep -v grep | awk '{print $2}'`
if [ "x$RUBYPID" = "x" ]; then
echo "* Redmine is not running"
else
echo "* Redmine is running"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart|force-reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
esac
我创建了文件/etc/init.d/redmine可执行文件,通过
将其添加到启动序列中update-rc.d redmine defaults
重启操作系统后,执行redmine脚本,如redmine-start.log文件所示,但此文件报告错误。
完整输出如下所示:
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize ': Could not find json-1.8.3 in any of the sources ( Bundler :: GemNotFound)
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map! '
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize '
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs'
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for '
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs'
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs'
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup '
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup '
from /var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<top (required)> '
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require '
据我判断,这个错误表示无法找到文件json-1.8.3,看起来,问题是没有安装的东西。但是,如果我尝试手动启动redmine,即
/etc/init.d/redmine start
这个开始会毫无错误地发生。下一个自然假设是错误是在系统启动后按启动脚本的顺序排列的。但是这个假设没有给出任何东西,因为这条线应该确保尽可能晚地推出Redmine。
必需 - 开始:$ all
我还手动尝试接受一些加载顺序,但这不起作用。 我得到了类似的否定结果,如果不是 /etc/init.d 我将脚本添加到 /etc/rc.local ,而不是更新 - rc.d 我使用 insserv 。
指南,其他人的脚本也会出现同样的错误,在这种情况下,我在Google中找不到这个错误。
如何解决此问题?
答案 0 :(得分:1)
在barChartOptions: any = {
scaleShowVerticalLines: false,
responsive: true,
scales: {
xAxes: [{
ticks: {
beginAtZero:true
}
}]
}
};
barChartLabels: string[] =[];
barChartType: string = 'horizontalBar';
barChartLegend: boolean = true;
barChartData: any[] =[];
resultData: Animal[] =[];
loaded = false;
ngOnInit(){
console.log(this._invService.getinvfull());
this._invService.getinvfull().subscribe(
data1 => {
if (!data1) {
console.log('error al cargar datos');
} else {
this.resultData = data1;
this.barChartLabels = this.resultData.map(item => item.fecha);
//this.lineChartLabels = this.resultData.map(item => item.fecha);
var d=this.resultData.map(item => item.sensorluz1)
console.log('esta es la variable d'+d);
this.barChartData = this.resultData.map(item => item.sensorluz1);
//let newChartData:Array<any> = [];
//newChartData.push({data: [1, 2], label: 'Series A'}, {data: [1, 2], label: 'Series B'});
//this.lineChartData = newChartData;
this.data = this.barChartData;
console.log(this.barChartData);
console.log('la variable data'+this.data);
this.loaded = true;
//data = this.animals;
}
},
error =>{
console.log(<any>error);
}
);
}
<canvas *ngIf="loaded" baseChart [data]="barChartData"
[labels]="barChartLabels" [options]="barChartOptions"
[legend]="barChartLegend" [chartType]="barChartType"
(chartHover)="chartHovered($event)" (chartClick)="chartClicked($event)">
</canvas>
中手动运行脚本不是一个好主意。该脚本将与继承自您的 shell的环境一起运行。因此,环境中的某些东西很有可能使它发挥作用。
要使用其/etc/init.d
脚本启动服务,请使用/etc/init.d
,以便:service
。如果这确实是一个环境问题,这也可能会失败。