在Windows上将wiki.js作为服务运行的正确pm2命令是什么?

时间:2018-10-22 16:49:33

标签: node.js windows-services pm2

当wiki.js命令需要这样的参数时,如何从pm2启动和停止wiki.js:

public class Adapter extends RecyclerView.Adapter<Adapter.ViewHolder> {

private List<Model> models;
Model model;
// public MyAdapterListener onClickListener;

SparseBooleanArray mStateButtons = new SparseBooleanArray();


public Adapter(List<Model> models){
    this.models = models;
}

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.single_row, false);
    return  new ViewHolder(view);
}

@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) {
    String question = models.get(position).getQues();
    final String optA = models.get(position).getOptA();
    final String optB = models.get(position).getOptB();
    final String optC = models.get(position).getOptC();
    final String optD = models.get(position).getOptD();
    final String answer = models.get(position).getAns();

    holder.question.setText(question);
    holder.optA.setText(optA);
    holder.optB.setText(optB);
    holder.optC.setText(optC);
    holder.optD.setText(optD);

    holder.options.setTag(position);
    holder.options.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            int radioButtonID = group.getCheckedRadioButtonId();
            int clickedPos = (Integer) group.getTag();

            models.get(clickedPos).setChecked(radioButtonID);


        }
    });
    holder.options.check(models.get(position).getChecked());

    final int currentPosition = holder.getAdapterPosition();
    final Button button = holder.seeAnswer;

    if(mStateButtons.valueAt(currentPosition)) {
        button.setVisibility(View.GONE);
    } else {
        button.setVisibility(View.VISIBLE);
    }

    holder.seeAnswer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mStateButtons.put(position, true);
        }
    });

}

@Override
public int getItemCount() {
    return Models.size();
}

class ViewHolder extends RecyclerView.ViewHolder{

    TextView question;
    RadioButton optA, optB, optC, optD;
    Button seeAnswer;
    RadioGroup options;

    public ViewHolder(View itemView) {
        super(itemView);

        options = (RadioGroup) itemView.findViewById(R.id.rgMcqOptions);
        question = (TextView) itemView.findViewById(R.id.tvMcqQues);
        optA = (RadioButton) itemView.findViewById(R.id.rbOptA);
        optB = (RadioButton) itemView.findViewById(R.id.rbOptB);
        optC = (RadioButton) itemView.findViewById(R.id.rbOptC);
        optD = (RadioButton) itemView.findViewById(R.id.rbOptD);
        seeAnswer = (Button) itemView.findViewById(R.id.btnSeeAnswer);

    }

}
}

我尝试开始使用命令:

node wiki start // to start
node wiki stop  // to stop

但是在日志中我收到此错误:

pm2 start wiki.js --node-args start

Wiki.js documentation没有解释这部分。

2 个答案:

答案 0 :(得分:1)

这是正确的pm2命令,用于启动名称为 Wiki.js 和参数 start 的Wiki:

 pm2 start wiki.js --name="Wiki.js" -- start

或没有个性化名称:

pm2 start wiki.js -- start

最简单(最可靠)的方法是从节点开始wiki(它将出现在pm2中):

node wiki start

比通过以下方式保存配置:

pm2 save

答案 1 :(得分:0)

启动wiki.js的命令是

pm2 start wiki.js